RE: [PATCH v3 04/10] iommu/vt-d: Add helper to setup pasid nested translation

From: Liu, Yi L
Date: Wed Jun 07 2023 - 23:33:13 EST


> From: Liu, Yi L <yi.l.liu@xxxxxxxxx>
> Sent: Wednesday, June 7, 2023 4:34 PM
>
> > From: Baolu Lu <baolu.lu@xxxxxxxxxxxxxxx>
> > Sent: Friday, May 26, 2023 12:16 PM
>
> > >> +
> > >> + /* First level PGD (in GPA) must be supported by the second level. */
> > >> + if ((uintptr_t)s1_gpgd > (1ULL << s2_domain->gaw)) {
> > >> + dev_err_ratelimited(dev,
> > >> + "Guest PGD %lx not supported,
> > >> max %llx\n",
> > >> + (uintptr_t)s1_gpgd, s2_domain-
> > >>> max_addr);
> > >> + return -EINVAL;
> > >> + }
> > >
> > > I'm not sure how useful this check is. Even if the pgd is sane the
> > > lower level PTEs could include unsupported GPA's. If a guest really
> > > doesn't want to follow the GPA restriction which vIOMMU reports,
> > > it can easily cause IOMMU fault in many ways.
> >
> > You are right.
> >
> > > Then why treating pgd specially?
> >
> > I have no memory about this check for now. Yi, any thought?
>
> I don’t think there is another special reason. Just want to ensure the page table
> base address follows the GPA restriction. But as Kevin mentioned, hw can detect
> it anyway. So, I think this check can be dropped.

Then we also need to remove below words in the uapi header.

+ Hence the
+ * stage-1 page table base address value should not be higher than the
+ * maximum untranslated address of stage-2 page table.

Regards,
Yi Liu