diff mbox series

[15/17] IOMMU: page table dumping adjustments

Message ID d6b3d7e4-7ea0-387c-86d1-1fb3c59688fe@suse.com (mailing list archive)
State Superseded
Headers show
Series IOMMU: superpage support when not sharing pagetables | expand

Commit Message

Jan Beulich Aug. 24, 2021, 2:26 p.m. UTC
For one none of the three IOMMU implementations on Arm specify a dumping
hook. Generalize VT-d's "don't dump shared page tables" to cover for
this.

Further in the past I was told that on Arm in principle there could be
multiple different IOMMUs, and hence different domains' platform_ops
pointers could differ. Use each domain's ops for calling the dump hook.
(In the long run all uses of iommu_get_ops() would likely need to
disappear for this reason.)

Signed-off-by: Jan Beulich <jbeulich@suse.com>

Comments

Jan Beulich Aug. 24, 2021, 2:28 p.m. UTC | #1
On 24.08.2021 16:26, Jan Beulich wrote:
> For one none of the three IOMMU implementations on Arm specify a dumping
> hook. Generalize VT-d's "don't dump shared page tables" to cover for
> this.
> 
> Further in the past I was told that on Arm in principle there could be
> multiple different IOMMUs, and hence different domains' platform_ops
> pointers could differ. Use each domain's ops for calling the dump hook.
> (In the long run all uses of iommu_get_ops() would likely need to
> disappear for this reason.)
> 
> Signed-off-by: Jan Beulich <jbeulich@suse.com>

Should have Cc-ed Kevin on this one as well; now added.

Jan

> --- a/xen/drivers/passthrough/iommu.c
> +++ b/xen/drivers/passthrough/iommu.c
> @@ -640,12 +640,9 @@ bool_t iommu_has_feature(struct domain *
>  static void iommu_dump_page_tables(unsigned char key)
>  {
>      struct domain *d;
> -    const struct iommu_ops *ops;
>  
>      ASSERT(iommu_enabled);
>  
> -    ops = iommu_get_ops();
> -
>      rcu_read_lock(&domlist_read_lock);
>  
>      for_each_domain(d)
> @@ -653,7 +650,13 @@ static void iommu_dump_page_tables(unsig
>          if ( is_hardware_domain(d) || !is_iommu_enabled(d) )
>              continue;
>  
> -        ops->dump_page_tables(d);
> +        if ( iommu_use_hap_pt(d) )
> +        {
> +            printk("%pd sharing page tables\n", d);
> +            continue;
> +        }
> +
> +        dom_iommu(d)->platform_ops->dump_page_tables(d);
>      }
>  
>      rcu_read_unlock(&domlist_read_lock);
> --- a/xen/drivers/passthrough/vtd/iommu.c
> +++ b/xen/drivers/passthrough/vtd/iommu.c
> @@ -2835,12 +2835,6 @@ static void vtd_dump_page_tables(struct
>  {
>      const struct domain_iommu *hd = dom_iommu(d);
>  
> -    if ( iommu_use_hap_pt(d) )
> -    {
> -        printk(VTDPREFIX " %pd sharing EPT table\n", d);
> -        return;
> -    }
> -
>      printk(VTDPREFIX" %pd table has %d levels\n", d,
>             agaw_to_level(hd->arch.vtd.agaw));
>      vtd_dump_page_table_level(hd->arch.vtd.pgd_maddr,
> 
>
Tian, Kevin Sept. 16, 2021, 7:33 a.m. UTC | #2
> From: Jan Beulich <jbeulich@suse.com>
> Sent: Tuesday, August 24, 2021 10:29 PM
> 
> On 24.08.2021 16:26, Jan Beulich wrote:
> > For one none of the three IOMMU implementations on Arm specify a
> dumping
> > hook. Generalize VT-d's "don't dump shared page tables" to cover for
> > this.
> >
> > Further in the past I was told that on Arm in principle there could be
> > multiple different IOMMUs, and hence different domains' platform_ops
> > pointers could differ. Use each domain's ops for calling the dump hook.
> > (In the long run all uses of iommu_get_ops() would likely need to
> > disappear for this reason.)
> >
> > Signed-off-by: Jan Beulich <jbeulich@suse.com>
> 
> Should have Cc-ed Kevin on this one as well; now added.
> 
> Jan

Reviewed-by: Kevin Tian <kevin.tian@intel.com>

> 
> > --- a/xen/drivers/passthrough/iommu.c
> > +++ b/xen/drivers/passthrough/iommu.c
> > @@ -640,12 +640,9 @@ bool_t iommu_has_feature(struct domain *
> >  static void iommu_dump_page_tables(unsigned char key)
> >  {
> >      struct domain *d;
> > -    const struct iommu_ops *ops;
> >
> >      ASSERT(iommu_enabled);
> >
> > -    ops = iommu_get_ops();
> > -
> >      rcu_read_lock(&domlist_read_lock);
> >
> >      for_each_domain(d)
> > @@ -653,7 +650,13 @@ static void iommu_dump_page_tables(unsig
> >          if ( is_hardware_domain(d) || !is_iommu_enabled(d) )
> >              continue;
> >
> > -        ops->dump_page_tables(d);
> > +        if ( iommu_use_hap_pt(d) )
> > +        {
> > +            printk("%pd sharing page tables\n", d);
> > +            continue;
> > +        }
> > +
> > +        dom_iommu(d)->platform_ops->dump_page_tables(d);
> >      }
> >
> >      rcu_read_unlock(&domlist_read_lock);
> > --- a/xen/drivers/passthrough/vtd/iommu.c
> > +++ b/xen/drivers/passthrough/vtd/iommu.c
> > @@ -2835,12 +2835,6 @@ static void vtd_dump_page_tables(struct
> >  {
> >      const struct domain_iommu *hd = dom_iommu(d);
> >
> > -    if ( iommu_use_hap_pt(d) )
> > -    {
> > -        printk(VTDPREFIX " %pd sharing EPT table\n", d);
> > -        return;
> > -    }
> > -
> >      printk(VTDPREFIX" %pd table has %d levels\n", d,
> >             agaw_to_level(hd->arch.vtd.agaw));
> >      vtd_dump_page_table_level(hd->arch.vtd.pgd_maddr,
> >
> >
diff mbox series

Patch

--- a/xen/drivers/passthrough/iommu.c
+++ b/xen/drivers/passthrough/iommu.c
@@ -640,12 +640,9 @@  bool_t iommu_has_feature(struct domain *
 static void iommu_dump_page_tables(unsigned char key)
 {
     struct domain *d;
-    const struct iommu_ops *ops;
 
     ASSERT(iommu_enabled);
 
-    ops = iommu_get_ops();
-
     rcu_read_lock(&domlist_read_lock);
 
     for_each_domain(d)
@@ -653,7 +650,13 @@  static void iommu_dump_page_tables(unsig
         if ( is_hardware_domain(d) || !is_iommu_enabled(d) )
             continue;
 
-        ops->dump_page_tables(d);
+        if ( iommu_use_hap_pt(d) )
+        {
+            printk("%pd sharing page tables\n", d);
+            continue;
+        }
+
+        dom_iommu(d)->platform_ops->dump_page_tables(d);
     }
 
     rcu_read_unlock(&domlist_read_lock);
--- a/xen/drivers/passthrough/vtd/iommu.c
+++ b/xen/drivers/passthrough/vtd/iommu.c
@@ -2835,12 +2835,6 @@  static void vtd_dump_page_tables(struct
 {
     const struct domain_iommu *hd = dom_iommu(d);
 
-    if ( iommu_use_hap_pt(d) )
-    {
-        printk(VTDPREFIX " %pd sharing EPT table\n", d);
-        return;
-    }
-
     printk(VTDPREFIX" %pd table has %d levels\n", d,
            agaw_to_level(hd->arch.vtd.agaw));
     vtd_dump_page_table_level(hd->arch.vtd.pgd_maddr,