[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <BN9PR11MB52768F3CBE04513D1536EB9B8C3E2@BN9PR11MB5276.namprd11.prod.outlook.com>
Date: Wed, 11 Dec 2024 08:05:45 +0000
From: "Tian, Kevin" <kevin.tian@...el.com>
To: Nicolin Chen <nicolinc@...dia.com>, "jgg@...dia.com" <jgg@...dia.com>,
"will@...nel.org" <will@...nel.org>
CC: "corbet@....net" <corbet@....net>, "joro@...tes.org" <joro@...tes.org>,
"suravee.suthikulpanit@....com" <suravee.suthikulpanit@....com>,
"robin.murphy@....com" <robin.murphy@....com>, "dwmw2@...radead.org"
<dwmw2@...radead.org>, "baolu.lu@...ux.intel.com" <baolu.lu@...ux.intel.com>,
"shuah@...nel.org" <shuah@...nel.org>, "linux-kernel@...r.kernel.org"
<linux-kernel@...r.kernel.org>, "iommu@...ts.linux.dev"
<iommu@...ts.linux.dev>, "linux-arm-kernel@...ts.infradead.org"
<linux-arm-kernel@...ts.infradead.org>, "linux-kselftest@...r.kernel.org"
<linux-kselftest@...r.kernel.org>, "linux-doc@...r.kernel.org"
<linux-doc@...r.kernel.org>, "eric.auger@...hat.com" <eric.auger@...hat.com>,
"jean-philippe@...aro.org" <jean-philippe@...aro.org>, "mdf@...nel.org"
<mdf@...nel.org>, "mshavit@...gle.com" <mshavit@...gle.com>,
"shameerali.kolothum.thodi@...wei.com"
<shameerali.kolothum.thodi@...wei.com>, "smostafa@...gle.com"
<smostafa@...gle.com>, "ddutile@...hat.com" <ddutile@...hat.com>, "Liu, Yi L"
<yi.l.liu@...el.com>
Subject: RE: [PATCH v2 07/13] iommufd/viommu: Add iommufd_viommu_report_irq
helper
> From: Nicolin Chen <nicolinc@...dia.com>
> Sent: Wednesday, December 4, 2024 6:10 AM
>
> +/* Typically called in driver's threaded IRQ handler */
> +int iommufd_viommu_report_irq(struct iommufd_viommu *viommu,
> unsigned int type,
> + void *irq_ptr, size_t irq_len)
> +{
> + struct iommufd_eventq_virq *eventq_virq;
> + struct iommufd_virq *virq;
> + int rc = 0;
> +
> + might_sleep();
why is it required here but not in the iopf path?
> +
> + if (!viommu)
> + return -ENODEV;
> + if (WARN_ON_ONCE(!irq_len || !irq_ptr))
> + return -EINVAL;
> +
> + down_read(&viommu->virqs_rwsem);
> +
> + eventq_virq = iommufd_viommu_find_eventq_virq(viommu, type);
> + if (!eventq_virq) {
> + rc = -EOPNOTSUPP;
> + goto out_unlock_vdev_ids;
s/out_unlock_vdev_ids/out_unlock_virqs/
> + }
> +
> + virq = kzalloc(sizeof(*virq) + irq_len, GFP_KERNEL);
> + if (!virq) {
> + rc = -ENOMEM;
> + goto out_unlock_vdev_ids;
> + }
> + virq->irq_data = (void *)virq + sizeof(*virq);
> + memcpy(virq->irq_data, irq_ptr, irq_len);
> +
> + virq->eventq_virq = eventq_virq;
> + virq->irq_len = irq_len;
> +
> + iommufd_eventq_virq_handler(virq);
> +out_unlock_vdev_ids:
> + up_read(&viommu->virqs_rwsem);
> + return rc;
> +}
> +EXPORT_SYMBOL_NS_GPL(iommufd_viommu_report_irq, IOMMUFD);
> +
> MODULE_DESCRIPTION("iommufd code shared with builtin modules");
> MODULE_LICENSE("GPL");
> --
> 2.43.0
Powered by blists - more mailing lists