On Thu, Nov 13, 2025 at 05:07:50AM -0800, Shameer Kolothum wrote:
> > On Wed, 5 Nov 2025 at 23:49, Shameer Kolothum
> > <[email protected]> wrote:
> > >
> > > Install an event handler on the vEVENTQ fd to read and propagate host
> > > generated vIOMMU events to the guest.
> > >
> > > The handler runs in QEMU’s main loop, using a non-blocking fd registered
> > > via qemu_set_fd_handler().
> > >
> > > Signed-off-by: Shameer Kolothum <[email protected]>
> > 
> > Still don't understand how to use this vevent.
> > Is it to replace the fault queue (IOMMU_FAULT_QUEUE_ALLOC)?
> 
> No. IIUC, IOMMU_FAULT_QUEUE_ALLOC is to handle I/O page faults
> for any HWPT capable of handling page faults/response. The QEMU
> SMMUv3 still don't support page fault handling.
> 
> The VEVENTQ, on the other hand, provides a way to report any
> other s1 events to Guest.
> 
> See how events are reported in  arm_smmu_handle_event():
> 
> if (event->stall)
>     ret = iommu_report_device_fault(master->dev, &fault_evt); //Page faults
> else if (master->vmaster && !event->s2)
>     ret = arm_vmaster_report_event(master->vmaster, evt); //This series 
> handles this case.
> else
>     ret = -EOPNOTSUPP; 

Yes. We can say that FAULT_QUEUE is exclusively for PRI while the
vEVENTQ is for other types of HW events (or IRQs) related to the
guest stage-1. They can be used together.

> > And only find read, no write, only receive events but no response
> > (from guest kernel)?
> 
> Yes. And I am not sure what the long term plan is. We can still use
> IOMMU_FAULT_QUEUE_ALLOC for page fault handling or extend this 
> VEVENTQ  to have write() support for responses
> 
> To me, from an implementation perspective, both this FAULT and
> VEVENTQ look almost similar.
> 
> @Nicolin, any idea what's plan for page fault handling?

No. I think PRI should be done via FAULT_QUEUE.

> > By the way, can we use vevent in user space application? not in qemu
> > environment.
> 
> I didn't get that. Qemu is userspace. Or you meant just to receive any events
> from host SMMUv3 in user spacel? 

If user space application follows the iommufd uAPI like QEMU does,
it can. I am not sure about the use case though.

Nicolin

Reply via email to