> -----Original Message----- > From: Eric Auger <[email protected]> > Sent: 05 February 2026 08:33 > To: Shameer Kolothum Thodi <[email protected]>; qemu- > [email protected]; [email protected] > Cc: [email protected]; Nicolin Chen <[email protected]>; Nathan > Chen <[email protected]>; Matt Ochs <[email protected]>; Jason > Gunthorpe <[email protected]>; [email protected]; > [email protected]; [email protected]; Krishnakant Jaju > <[email protected]> > Subject: Re: [PATCH v4 3/5] hw/arm/smmuv3-accel: Allocate vEVENTQ for > accelerated SMMUv3 devices > > External email: Use caution opening links or attachments > > > Hi Shameer, > > On 2/4/26 8:00 PM, Shameer Kolothum wrote: > > From: Nicolin Chen <[email protected]> > > > > When the guest enables the Event Queue and a vIOMMU is present, allocate > a > > vEVENTQ object so that host-side events related to the vIOMMU can be > > received and propagated back to the guest. > > > > For cold-plugged devices using SMMUv3 acceleration, the vIOMMU is > created > > before the guest boots. In this case, the vEVENTQ is allocated when the > > guest writes to SMMU_CR0 and sets EVENTQEN = 1. > > > > If no cold-plugged device exists at boot (i.e. no vIOMMU initially), the > > vEVENTQ is allocated when a vIOMMU is created, i.e. during the first > > device hot-plug. > > > > Event read and propagation will be added in a later patch. > > > > Signed-off-by: Nicolin Chen <[email protected]> > > Tested-by: Nicolin Chen <[email protected]> > > Reviewed-by: Eric Auger <[email protected]> > > Signed-off-by: Shameer Kolothum <[email protected]> > > --- > > hw/arm/smmuv3-accel.c | 61 > +++++++++++++++++++++++++++++++++++++++++-- > > hw/arm/smmuv3-accel.h | 6 +++++ > > hw/arm/smmuv3.c | 4 +++ > > 3 files changed, 69 insertions(+), 2 deletions(-) > > > > diff --git a/hw/arm/smmuv3-accel.c b/hw/arm/smmuv3-accel.c > > index c19c526fca..2ca0d1deac 100644 > > --- a/hw/arm/smmuv3-accel.c > > +++ b/hw/arm/smmuv3-accel.c > > @@ -390,6 +390,19 @@ bool > smmuv3_accel_issue_inv_cmd(SMMUv3State *bs, void *cmd, SMMUDevice > *sdev, > > sizeof(Cmd), &entry_num, cmd, errp); > > } > > > > +static void smmuv3_accel_free_veventq(SMMUv3AccelState *accel) > > +{ > > + IOMMUFDVeventq *veventq = accel->veventq; > > + > > + if (!veventq) { > > + return; > > + } > > + close(veventq->veventq_fd); > > + iommufd_backend_free_id(accel->viommu->iommufd, veventq- > >veventq_id); > > + g_free(veventq); > > + accel->veventq = NULL; > > +} > > + > > static void smmuv3_accel_free_viommu(SMMUv3AccelState *accel) > > { > > IOMMUFDViommu *viommu = accel->viommu; > > @@ -397,6 +410,7 @@ static void > smmuv3_accel_free_viommu(SMMUv3AccelState *accel) > > if (!viommu) { > > return; > > } > > + smmuv3_accel_free_veventq(accel); > > iommufd_backend_free_id(viommu->iommufd, accel->bypass_hwpt_id); > > iommufd_backend_free_id(viommu->iommufd, accel->abort_hwpt_id); > > iommufd_backend_free_id(viommu->iommufd, accel->viommu- > >viommu_id); > > @@ -404,6 +418,41 @@ static void > smmuv3_accel_free_viommu(SMMUv3AccelState *accel) > > accel->viommu = NULL; > > } > > > > +bool smmuv3_accel_alloc_veventq(SMMUv3State *s, Error **errp) > > +{ > > + SMMUv3AccelState *accel = s->s_accel; > > + IOMMUFDVeventq *veventq; > > + uint32_t veventq_id; > > + uint32_t veventq_fd; > > you need to check !accel because in case of non accelerated SMMU it > sigsevs in smmu_writel/smmuv3_accel_alloc_veventq path
Oops. Right. Will add. Thanks, Shameer
