Re: [PATCH v5 08/14] iommufd/viommu: Add iommufd_viommu_report_event helper

From: Jason Gunthorpe
Date: Fri Jan 10 2025 - 14:51:27 EST


On Fri, Jan 10, 2025 at 10:38:42AM -0800, Nicolin Chen wrote:
> > The virtual event queue should behave the same as if the physical
> > event queue overflows, and that logic should be in the smmu driver -
> > this should return some Exxx to indicate the queue is filled.
>
> Hmm, the driver only screams...
>
> static irqreturn_t arm_smmu_evtq_thread(int irq, void *dev)
> {
> [...]
> /*
> * Not much we can do on overflow, so scream and pretend we're
> * trying harder.
> */
> if (queue_sync_prod_in(q) == -EOVERFLOW)
> dev_err(smmu->dev, "EVTQ overflow detected -- events lost\n");

Well it must know from the HW somehow that the overflow has happened??

> > I supposed we will need a way to indicate lost events to userspace on
> > top of this?
>
> Perhaps another u32 flag in the arm_smmuv3_vevent struct to report
> an overflow. That said, what userspace/VMM will need to do with it?

Trigger the above code in the VM somehow?

Jason