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

Liu, Yi L
2023-06-07T08:34:43Z

> From: Baolu Lu <baolu.lu@linux.intel.com>
> 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.

Regards,
Yi Liu