[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • To: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Tue, 24 Aug 2021 16:27:12 +0200
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=ekc106SeN5rQ4+mKbVywQpGio0tLIHNqkbPDTkhzXTA=; b=ZtuX8vqgWMuCVBdRDUtVigE0Gva21eFEEYDLPhK1ZDF1wbdtC4pDF0LgWr0t81oPejBMsZ+g6g3uGdI2ZzncUbKIc04IVn+dYN5WrkuXG4KiAeYTkYwLVwMB26m4aXIGrdTtgCLq/L27i/TNTutCWQDpYdFnLyguHmUXTCmGB73HOqU031+n3Th3vxxDG/caKzhUdMRGyNTFc5iMIXFwXxJ8oGQ9CX0TPpUDhLeukwXF2pTwNuYNRg2nFaNd36F05lupZ4sOgWI88STHaruVl2QcPH1s2SiLRyFrTMch+9II9yp1IUDvg7LuaNHflLK7xYK3tzgMp5E2TXJGmJg4Sg==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=lrm3e6A5wvAUsNu83p6gsmlp44wd9x7J22oJaT4Z91czIqCAqQbgKonA/e7eIfH9DHP1uu0QXrDkTWsyK42VftZ0/ssJIGtGKK317BMbfx1ka6OItm5187QU5OTQ81KO61b8tx8kXu/0UD0LmHv8M9t/97y8lZ5tUuoX8AHDSTGTimBIb1BYLh0llKvMTYGtFVIuU2Ps0Zk5o5KnUSaWv2f5Nn2/ZsQqyEIpYJj8Vd5UqlDVeXiW7IoOqcBK6B/hI8g1FIk6O0EqcD4TTrltYoah7Ggmh/atYxO6LekDSdHceahWVnrxf7RPwMpV6f9mm86ybNZ3iYCGHIE9/VvnNQ==
  • Authentication-results: intel.com; dkim=none (message not signed) header.d=none;intel.com; dmarc=none action=none header.from=suse.com;
  • Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Paul Durrant <paul@xxxxxxx>, Kevin Tian <kevin.tian@xxxxxxxxx>
  • Delivery-date: Tue, 24 Aug 2021 14:27:20 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

Besides the addresses this is the next crucial bit of information one
might be after.

Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>

--- 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 );




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.