Re: [RFC PATCH 39/45] iommu/arm-smmu-v3-kvm: Initialize page table configuration

Jean-Philippe Brucker
2023-03-22T14:43:33Z

Hi Mostafa,

On Wed, Mar 22, 2023 at 10:23:50AM +0000, Mostafa Saleh wrote:
> > + /*
> > + * Stage-1 should be easy to support, though we do need to allocate a
> > + * context descriptor table.
> > + */
> > + cfg = (struct io_pgtable_cfg) {
> > + .fmt = ARM_64_LPAE_S2,
> > + .pgsize_bitmap = smmu->pgsize_bitmap,
> > + .ias = smmu->ias,
> > + .oas = smmu->oas,
> > + .coherent_walk = smmu->features & ARM_SMMU_FEAT_COHERENCY,
> > + };
> > +
> > + /*
> > + * Choose the page and address size. Compute the PGD size and number of
> > + * levels as well, so we know how much memory to pre-allocate.

(I also need to fix that comment, we're not getting the number of levels anymore)

> > + */
> > + ret = io_pgtable_configure(&cfg, &size);
> size variable is overwritten here with pgd size, while used later on
> the assumption it still contains the SMMU MMIO size.
> This looks like it is not intended?

No it's a bug, thanks for spotting it. I'll try to update the pkvm/smmu
branch today with the other issues you reported

Thanks,
Jean