RE: [PATCH v1 14/22] intel_iommu: bind/unbind guest page table to host

Liu, Yi L
2020-03-25T12:47:33Z

> From: Peter Xu <peterx@redhat.com>
> Sent: Wednesday, March 25, 2020 1:47 AM
> To: Liu, Yi L <yi.l.liu@intel.com>
> Sent: Wednesday, March 25, 2020 1:47 AM
> Subject: Re: [PATCH v1 14/22] intel_iommu: bind/unbind guest page table to host
>
> On Sun, Mar 22, 2020 at 05:36:11AM -0700, Liu Yi L wrote:
> > This patch captures the guest PASID table entry modifications and
> > propagates the changes to host to setup dual stage DMA translation.
> > The guest page table is configured as 1st level page table (GVA->GPA)
> > whose translation result would further go through host VT-d 2nd level
> > page table(GPA->HPA) under nested translation mode. This is the key
> > part of vSVA support, and also a key to support IOVA over 1st- level
> > page table for Intel VT-d in virtualization environment.
> >
> > Cc: Kevin Tian <kevin.tian@intel.com>
> > Cc: Jacob Pan <jacob.jun.pan@linux.intel.com>
> > Cc: Peter Xu <peterx@redhat.com>
> > Cc: Yi Sun <yi.y.sun@linux.intel.com>
> > Cc: Paolo Bonzini <pbonzini@redhat.com>
> > Cc: Richard Henderson <rth@twiddle.net>
> > Signed-off-by: Liu Yi L <yi.l.liu@intel.com>
> > ---
> > hw/i386/intel_iommu.c | 98
> +++++++++++++++++++++++++++++++++++++++---
> > hw/i386/intel_iommu_internal.h | 25 +++++++++++
> > 2 files changed, 118 insertions(+), 5 deletions(-)
> >
> > diff --git a/hw/i386/intel_iommu.c b/hw/i386/intel_iommu.c index
> > c985cae..0423c83 100644
> > --- a/hw/i386/intel_iommu.c
> > +++ b/hw/i386/intel_iommu.c
> > @@ -41,6 +41,7 @@
> > #include "migration/vmstate.h"
> > #include "trace.h"
> > #include "qemu/jhash.h"
> > +#include <linux/iommu.h>
> >
> > /* context entry operations */
> > #define VTD_CE_GET_RID2PASID(ce) \
> > @@ -695,6 +696,16 @@ static inline uint16_t
> vtd_pe_get_domain_id(VTDPASIDEntry *pe)
> > return VTD_SM_PASID_ENTRY_DID((pe)->val[1]);
> > }
> >
[...]
> > +
> > + bind_data = g_malloc0(sizeof(*bind_data));
> > + bind_data->pasid = pasid;
> > + g_bind_data = &bind_data->bind_data.gpasid_bind;
> > +
> > + g_bind_data->flags = 0;
> > + g_bind_data->vtd.flags = 0;
> > + switch (op) {
> > + case VTD_PASID_BIND:
> > + case VTD_PASID_UPDATE:
>
> Is VTD_PASID_UPDATE used anywhere?

Hmmm, there is update case in the code. But, this macro is not
used explicitly in this patch. Maybe I should drop it.

Regards,
Yi Liu