diff mbox series

[16/17] VT-d: show permissions during page table walks

Message ID d4619379-3557-05ac-236a-06a169479a4e@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:27 p.m. UTC
Besides the addresses this is the next crucial bit of information one
might be after.

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

Comments

Tian, Kevin Sept. 16, 2021, 7:36 a.m. UTC | #1
> From: Jan Beulich <jbeulich@suse.com>
> Sent: Tuesday, August 24, 2021 10:27 PM
> 
> Besides the addresses this is the next crucial bit of information one
> might be after.
> 
> Signed-off-by: Jan Beulich <jbeulich@suse.com>

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

> 
> --- a/xen/drivers/passthrough/vtd/iommu.c
> +++ b/xen/drivers/passthrough/vtd/iommu.c
> @@ -2822,10 +2822,12 @@ static void vtd_dump_page_table_level(pa
>              vtd_dump_page_table_level(dma_pte_addr(*pte), next_level,
>                                        address, indent + 1);
>          else
> -            printk("%*sdfn: %08lx mfn: %08lx\n",
> +            printk("%*sdfn: %08lx mfn: %08lx %c%c\n",
>                     indent, "",
>                     (unsigned long)(address >> PAGE_SHIFT_4K),
> -                   (unsigned long)(dma_pte_addr(*pte) >> PAGE_SHIFT_4K));
> +                   (unsigned long)(dma_pte_addr(*pte) >> PAGE_SHIFT_4K),
> +                   dma_pte_read(*pte) ? 'r' : '-',
> +                   dma_pte_write(*pte) ? 'w' : '-');
>      }
> 
>      unmap_vtd_domain_page(pt_vaddr);
> --- a/xen/drivers/passthrough/vtd/utils.c
> +++ b/xen/drivers/passthrough/vtd/utils.c
> @@ -159,14 +159,11 @@ void print_vtd_entries(struct vtd_iommu
>          l_index = get_level_index(gmfn, level);
>          pte.val = l[l_index];
>          unmap_vtd_domain_page(l);
> -        printk("    l%u[%03x] = %"PRIx64"\n", level, l_index, pte.val);
> +        printk("    l%u[%03x] = %"PRIx64" %c%c\n", level, l_index, pte.val,
> +               dma_pte_read(pte) ? 'r' : '-',
> +               dma_pte_write(pte) ? 'w' : '-');
> 
> -        if ( !dma_pte_present(pte) )
> -        {
> -            printk("    l%u[%03x] not present\n", level, l_index);
> -            break;
> -        }
> -        if ( dma_pte_superpage(pte) )
> +        if ( !dma_pte_present(pte) || dma_pte_superpage(pte) )
>              break;
>          val = dma_pte_addr(pte);
>      } while ( --level );
diff mbox series

Patch

--- a/xen/drivers/passthrough/vtd/iommu.c
+++ b/xen/drivers/passthrough/vtd/iommu.c
@@ -2822,10 +2822,12 @@  static void vtd_dump_page_table_level(pa
             vtd_dump_page_table_level(dma_pte_addr(*pte), next_level,
                                       address, indent + 1);
         else
-            printk("%*sdfn: %08lx mfn: %08lx\n",
+            printk("%*sdfn: %08lx mfn: %08lx %c%c\n",
                    indent, "",
                    (unsigned long)(address >> PAGE_SHIFT_4K),
-                   (unsigned long)(dma_pte_addr(*pte) >> PAGE_SHIFT_4K));
+                   (unsigned long)(dma_pte_addr(*pte) >> PAGE_SHIFT_4K),
+                   dma_pte_read(*pte) ? 'r' : '-',
+                   dma_pte_write(*pte) ? 'w' : '-');
     }
 
     unmap_vtd_domain_page(pt_vaddr);
--- a/xen/drivers/passthrough/vtd/utils.c
+++ b/xen/drivers/passthrough/vtd/utils.c
@@ -159,14 +159,11 @@  void print_vtd_entries(struct vtd_iommu
         l_index = get_level_index(gmfn, level);
         pte.val = l[l_index];
         unmap_vtd_domain_page(l);
-        printk("    l%u[%03x] = %"PRIx64"\n", level, l_index, pte.val);
+        printk("    l%u[%03x] = %"PRIx64" %c%c\n", level, l_index, pte.val,
+               dma_pte_read(pte) ? 'r' : '-',
+               dma_pte_write(pte) ? 'w' : '-');
 
-        if ( !dma_pte_present(pte) )
-        {
-            printk("    l%u[%03x] not present\n", level, l_index);
-            break;
-        }
-        if ( dma_pte_superpage(pte) )
+        if ( !dma_pte_present(pte) || dma_pte_superpage(pte) )
             break;
         val = dma_pte_addr(pte);
     } while ( --level );