[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <BN9PR11MB52766E5569D115A4762AE9B68CFCA@BN9PR11MB5276.namprd11.prod.outlook.com>
Date: Mon, 25 Sep 2023 06:54:54 +0000
From: "Tian, Kevin" <kevin.tian@...el.com>
To: Lu Baolu <baolu.lu@...ux.intel.com>,
Joerg Roedel <joro@...tes.org>,
"Will Deacon" <will@...nel.org>,
Robin Murphy <robin.murphy@....com>,
"Jason Gunthorpe" <jgg@...pe.ca>,
Jean-Philippe Brucker <jean-philippe@...aro.org>,
Nicolin Chen <nicolinc@...dia.com>
CC: "Liu, Yi L" <yi.l.liu@...el.com>,
Jacob Pan <jacob.jun.pan@...ux.intel.com>,
"iommu@...ts.linux.dev" <iommu@...ts.linux.dev>,
"kvm@...r.kernel.org" <kvm@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: RE: [PATCH v5 11/12] iommu: Consolidate per-device fault data
management
> From: Lu Baolu <baolu.lu@...ux.intel.com>
> 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(¶m->lock);
> + if (WARN_ON(fault_param->users <= 0 ||
> + fault_param != param->fault_param)) {
> + mutex_unlock(¶m->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@...el.com>
Powered by blists - more mailing lists