iommu/vt-d: Dump DMAR translation structure
Subsystems (2)
PATCH v2 1/1 iommu/vt-d: Dump DMAR translation structure
When the dmar translation fault happens, the kernel prints a single line fault reason with corresponding hexadecimal code defined in the Intel VT-d specification.
Currently, when user wants to debug the translation fault in detail, debugfs is used for dumping the dmar_translation_struct, which is not available when the kernel failed to boot.
Dump the DMAR translation structure, pagewalk the IO page table and print the page table entry when the fault happens.
---
ChangeLog:
- Change from v1 to v2:
1. fix compilation issue with different IOMMU config option.
--- drivers/iommu/intel/dmar.c | 8 ++- drivers/iommu/intel/iommu.c | 107 ++++++++++++++++++++++++++++++++++++ include/linux/dmar.h | 4 ++ 3 files changed, 116 insertions(+), 3 deletions(-)
drivers/iommu/intel/dmar.c +5 -3
@@ -1948,19 +1948,21 @@ static int dmar_fault_do_one(struct intel_iommu *iommu, int type, source_id >>8 ,PCI_SLOT (source_id &0xFF ),PCI_FUNC (source_id &0xFF ), addr >>48 , fault_reason, reason); - else if (pasid == INVALID_IOASID) + else if (pasid == INVALID_IOASID) {pr_err ("[%s NO_PASID] Request device [0x%02x:0x%02x.%d] fault addr 0x%llx [fault reason 0x%02x] %s\n" , type ?"DMA Read" :"DMA Write" , source_id >>8 ,PCI_SLOT (source_id &0xFF ),PCI_FUNC (source_id &0xFF ), addr, fault_reason, reason); - else +dmar_fault_dump_ptes (iommu, source_id, addr, pasid); + } else {pr_err ("[%s PASID 0x%x] Request device [0x%02x:0x%02x.%d] fault addr 0x%llx [fault reason 0x%02x] %s\n" , type ?"DMA Read" :"DMA Write" , pasid, source_id >>8 ,PCI_SLOT (source_id &0xFF ),PCI_FUNC (source_id &0xFF ), addr, fault_reason, reason); - +dmar_fault_dump_ptes (iommu, source_id, addr, pasid); + }return 0 ; }
drivers/iommu/intel/iommu.c +107 -0
119 lines not on this page · raw message
include/linux/dmar.h +4 -0
@@ -142,9 +142,13 @@ extern int dmar_parse_one_satc(struct acpi_dmar_header *hdr, void *arg);extern int dmar_release_one_atsr (struct acpi_dmar_header *hdr,void *arg);extern int dmar_iommu_hotplug (struct dmar_drhd_unit *dmaru,bool insert);extern int dmar_iommu_notify_scope_dev (struct dmar_pci_notify_info *info); +void dmar_fault_dump_ptes (struct intel_iommu *iommu,u16 source_id, +unsigned long long addr,u32 pasid);#else /* !CONFIG_INTEL_IOMMU: */ static inline int intel_iommu_init (void ) {return -ENODEV ; }static inline void intel_iommu_shutdown (void ) { } +static inline void dmar_fault_dump_ptes (struct intel_iommu *iommu,u16 source_id, +unsigned long long addr,u32 pasid) {}#define dmar_parse_one_rmrr dmar_res_noop#define dmar_parse_one_atsr dmar_res_noop
Signature · 1 line
2.17.1
Joerg Roedel
maintainerQuoted 4 lines · Kyung Min Park
When the dmar translation fault happens, the kernel prints a single line fault reason with corresponding hexadecimal code defined in the Intel VT-d specification.
Quoted 8 lines
Currently, when user wants to debug the translation fault in detail, debugfs is used for dumping the
dmar_translation_struct, which is not available when the kernel failed to boot.Dump the DMAR translation structure, pagewalk the IO page table and print the page table entry when the fault happens.
Signed-off-by Kyung Min Park <[email protected]>
This is too much noise in dmesg for a single dmar fault. Please hide that additional debug information behind a debug kernel option for the VT-d driver.
Thanks,
Joerg
Hi Joerg,
Quoted 17 lines · Joerg Roedel
Quoted 16 lines · Kyung Min Park
When the dmar translation fault happens, the kernel prints a single line
fault reason with corresponding hexadecimal code defined in the Intel VT-d
specification.Currently, when user wants to debug the translation fault in detail,
debugfs is used for dumping thedmar_translation_struct, which is not
available when the kernel failed to boot.Dump the DMAR translation structure, pagewalk the IO page table and print
the page table entry when the fault happens.
Quoted 6 lines
Quoted 1 line
Signed-off-by Kyung Min Park <[email protected]>This is too much noise in dmesg for a single dmar fault. Please hide that additional debug information behind a debug kernel option for the
VT-d driver.
Sure, let me change in the next version.