[PATCH v8 2/4] iommu/io-pgtable-arm: Re-use the pgtable walk for iova_to_phys

Rob Clark robdclark at gmail.com
Tue Aug 27 09:54:29 PDT 2024


On Tue, Aug 27, 2024 at 5:02 AM Will Deacon <will at kernel.org> wrote:
>
> On Mon, Aug 26, 2024 at 10:15:39AM -0700, Rob Clark wrote:
> > @@ -776,7 +775,7 @@ static int io_pgtable_visit(struct arm_lpae_io_pgtable *data,
> >               return 0;
> >       }
> >
> > -     if (WARN_ON(!iopte_table(pte, lvl)))
> > +     if (WARN_ON(!iopte_table(pte, lvl) && !selftest_running))
> >               return -EINVAL;
> >
> >       ptep = iopte_deref(pte, data);
>
> I still don't grok this hunk. If the selftest is running, we want to
> return -EINVAL here rather than dereference something that isn't a
> table, right?
>
> Suppressing the warning is one thing, but this seems to do more than
> that.

oh, that should be

   if (!iopte_table(...)) {
      WARN_ON(!selftest_running);
      return -EINVAL;
   }

I did boot with selftests enabled, and it didn't _seem_ to complain
about anything, so I overlooked that

BR,
-R

>
> Will



More information about the linux-arm-kernel mailing list