Re: [PATCH v4 3/6] iommu/amd: Modify set_dte_entry() to use 256-bit DTE helpers

From: Jason Gunthorpe
Date: Thu Oct 03 2024 - 14:49:46 EST


On Thu, Oct 03, 2024 at 11:16:19PM +0700, Suthikulpanit, Suravee wrote:

> > > + tmp = gcr3_info->glx;
> > > + target->data[0] |= (tmp & DTE_GLX_MASK) << DTE_GLX_SHIFT;
> > > + if (pdom_is_v2_pgtbl_mode(dev_data->domain))
> > > + target->data[0] |= DTE_FLAG_GIOV;
> >
> > When does this get called to install a gcr3 table without a v2 domain?
>
> The GCR3 table is also used when we setup v2 table for SVA stuff. In such
> case, we would be setting up w/ PASID. Therefore, the GIOV bit is not
> needed.

If I understand the manual right this should be written as:

if (dev_data->domain->type != IDENTITY)
target->data[0] |= DTE_FLAG_GIOV;

Ie everything on the RID except identity should be translated through
PASID 0 and if PASID 0 is a V2 page table then it will translate and
if PASID 0 is non-valid then it will block?

Identity needs to not use GIOV otherwise it will be blocking?

Jason