RE: [RFC PATCH v6 11/11] PCI/TSM: Add reference-counted contexts for vdevice providers

From: Tian, Kevin

Date: Thu Sep 24 2026 - 04:21:01 EST


> From: Aneesh Kumar K.V (Arm) <aneesh.kumar@xxxxxxxxxx>
> Sent: Thursday, September 17, 2026 10:02 PM
[...]
> + pf0 = to_pci_tsm_pf0(pdev->tsm);
> + if (!pf0)
> + return ERR_PTR(-ENXIO);
> +
> + context = kzalloc_obj(*context);
> + if (!context)
> + return ERR_PTR(-ENOMEM);
> +
> + guard(mutex)(&pf0->lock);
> + pf0->context_users++;
> + context->pf0 = pf0;
> + context->pdev = pci_dev_get(pdev);
> + INIT_LIST_HEAD(&context->bound_node);
> + context->dsm_dev = pci_dev_get(pf0->base_tsm.pdev);
> + tsm_device = get_device(&pdev->tsm->tsm_dev->dev);

is it redundant? Ideally we just need hold one reference when
initializing the vIOMMU...

btw if it's indeed required, use tsm_get() instead?