Re: [PATCH v11 03/11] iommu/arm-smmu-v3: Swap EVTQ_MSI_INDEX and GERROR_MSI_INDEX
From: Jason Gunthorpe
Date: Tue Oct 20 2026 - 11:05:09 EST
On Tue, Oct 13, 2026 at 10:41:40AM -0700, Nicolin Chen wrote:
> On Tue, Oct 13, 2026 at 11:49:36AM -0300, Jason Gunthorpe wrote:
> > I think if you want to compress the nvec's array it should be done
> > directly.
> >
> > The smmu should have a small array
> > u8 msi_map[]
> >
> > Which holds the xx_MSI_INDEX value. Then arm_smmu_write_msi_msg()
> > would indirect to get the config:
> >
> > phys_addr_t *cfg = arm_smmu_msi_cfg[smmu->msi_map[desc->msi_index]];
> >
> > And we just compress msi_map as we go through the normal flow
> >
> > index_msi[EVTQ_MSI_INDEX] = nvec;
> > smmu->msi_map[nvec++] = EVTQ_MSI_INDEX
> >
> > Then it isn't fragile at all.
>
> Thanks. I replaced this patch with:
>
> Subject: [PATCH] iommu/arm-smmu-v3: Pack the MSI vectors of the used sources
>
> arm_smmu_setup_msis() skips the PRIQ vector by decreasing nvec, which only
> works since PRIQ_MSI_INDEX is the last index. A subsequent change will make
> the EVTQ optional for kdump, whose index is 0, so that trick won't work.
>
> Pack the vectors of the used sources instead, and record the source of each
> vector in a new msi_map, for arm_smmu_write_msi_msg() to find the register
> set, regardless of the sources in use.
Yeah that looks pretty easy to understand
Jason