RE: [PATCH v5 11/12] iommu: Consolidate per-device fault data management

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> From: Lu Baolu <baolu.lu@xxxxxxxxxxxxxxx>
> Sent: Thursday, September 14, 2023 4:57 PM
> 
> +
> +/* Caller must hold a reference of the fault parameter. */
> +static void iopf_put_dev_fault_param(struct iommu_fault_param
> *fault_param)
> +{
> +	struct device *dev = fault_param->dev;
> +	struct dev_iommu *param = dev->iommu;
> +
> +	mutex_lock(&param->lock);
> +	if (WARN_ON(fault_param->users <= 0 ||
> +		    fault_param != param->fault_param)) {
> +		mutex_unlock(&param->lock);
> +		return;
> +	}
> +
> +	if (--fault_param->users == 0) {
> +		param->fault_param = NULL;
> +		kfree(fault_param);
> +		put_device(dev);
> +	}

this could be a helper to be shared with iopf_queue_remove_device().

Reviewed-by: Kevin Tian <kevin.tian@xxxxxxxxx>




[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux