• Jingqi Liu's avatar
    iommu/vt-d: debugfs: Support dumping a specified page table · 2b437e80
    Jingqi Liu authored
    The original debugfs only dumps all page tables without pasid. With
    pasid supported, the page table with pasid also needs to be dumped.
    
    This patch supports dumping a specified page table in legacy mode or
    scalable mode with or without a specified pasid.
    
    For legacy mode, according to bus number and DEVFN, traverse the root
    table and context table to get the pointer of page table in the
    context table entry, then dump the specified page table.
    
    For scalable mode, according to bus number, DEVFN and pasid, traverse
    the root table, context table, pasid directory and pasid table to get
    the pointer of page table in the pasid table entry, then dump the
    specified page table..
    
    Examples are as follows:
    1) Dump the page table of device "0000:00:1f.0" that only supports
       legacy mode.
       $ sudo cat
       /sys/kernel/debug/iommu/intel/0000:00:1f.0/domain_translation_struct
    
    2) Dump the page table of device "0000:00:0a.0" with PASID "1" that
       supports scalable mode.
       $ sudo cat
       /sys/kernel/debug/iommu/intel/0000:00:0a.0/1/domain_translation_struct
    Suggested-by: default avatarKevin Tian <kevin.tian@intel.com>
    Signed-off-by: default avatarJingqi Liu <Jingqi.liu@intel.com>
    Link: https://lore.kernel.org/r/20231013135811.73953-4-Jingqi.liu@intel.comSigned-off-by: default avatarLu Baolu <baolu.lu@linux.intel.com>
    Signed-off-by: default avatarJoerg Roedel <jroedel@suse.de>
    2b437e80
debugfs.c 22.2 KB