Commit 66b29760 authored by Allen Kay's avatar Allen Kay

[VTD] print out debug message in vt-d fault handler only when iommu=debug is set

Print out debug messages in vtd_page_fault() handler only when
iommu=debug is set xen boot parameter.
Signed-off-by: default avatarAllen Kay <allen.m.kay@intel.com>
parent 9c1ebbba
......@@ -817,7 +817,7 @@ static int __init parse_ivrs_table(struct acpi_table_header *_table)
BUG_ON(!table);
if ( amd_iommu_debug )
if ( iommu_debug )
dump_acpi_table_header(table);
/* parse IVRS blocks */
......
......@@ -48,7 +48,7 @@ bool_t __read_mostly iommu_snoop = 1;
bool_t __read_mostly iommu_qinval = 1;
bool_t __read_mostly iommu_intremap = 1;
bool_t __read_mostly iommu_hap_pt_share;
bool_t __read_mostly amd_iommu_debug;
bool_t __read_mostly iommu_debug;
bool_t __read_mostly amd_iommu_perdev_intremap;
static void __init parse_iommu_param(char *s)
......@@ -74,8 +74,8 @@ static void __init parse_iommu_param(char *s)
iommu_qinval = 0;
else if ( !strcmp(s, "no-intremap") )
iommu_intremap = 0;
else if ( !strcmp(s, "amd-iommu-debug") )
amd_iommu_debug = 1;
else if ( !strcmp(s, "debug") )
iommu_debug = 1;
else if ( !strcmp(s, "amd-iommu-perdev-intremap") )
amd_iommu_perdev_intremap = 1;
else if ( !strcmp(s, "dom0-passthrough") )
......
......@@ -818,7 +818,7 @@ static int iommu_page_fault_do_one(struct iommu *iommu, int type,
if ( fault_type == DMA_REMAP )
{
dprintk(XENLOG_WARNING VTDPREFIX,
INTEL_IOMMU_DEBUG(
"DMAR:[%s] Request device [%02x:%02x.%d] "
"fault addr %"PRIx64", iommu reg = %p\n"
"DMAR:[fault reason %02xh] %s\n",
......@@ -827,12 +827,13 @@ static int iommu_page_fault_do_one(struct iommu *iommu, int type,
PCI_FUNC(source_id & 0xFF), addr, iommu->reg,
fault_reason, reason);
#ifndef __i386__ /* map_domain_page() cannot be used in this context */
print_vtd_entries(iommu, (source_id >> 8),
if (iommu_debug)
print_vtd_entries(iommu, (source_id >> 8),
(source_id & 0xff), (addr >> PAGE_SHIFT));
#endif
}
else
dprintk(XENLOG_WARNING VTDPREFIX,
INTEL_IOMMU_DEBUG(
"INTR-REMAP: Request device [%02x:%02x.%d] "
"fault index %"PRIx64", iommu reg = %p\n"
"INTR-REMAP:[fault reason %02xh] %s\n",
......@@ -846,26 +847,19 @@ static int iommu_page_fault_do_one(struct iommu *iommu, int type,
static void iommu_fault_status(u32 fault_status)
{
if ( fault_status & DMA_FSTS_PFO )
dprintk(XENLOG_ERR VTDPREFIX,
"iommu_fault_status: Fault Overflow\n");
INTEL_IOMMU_DEBUG("iommu_fault_status: Fault Overflow\n");
if ( fault_status & DMA_FSTS_PPF )
dprintk(XENLOG_ERR VTDPREFIX,
"iommu_fault_status: Primary Pending Fault\n");
INTEL_IOMMU_DEBUG("iommu_fault_status: Primary Pending Fault\n");
if ( fault_status & DMA_FSTS_AFO )
dprintk(XENLOG_ERR VTDPREFIX,
"iommu_fault_status: Advanced Fault Overflow\n");
INTEL_IOMMU_DEBUG("iommu_fault_status: Advanced Fault Overflow\n");
if ( fault_status & DMA_FSTS_APF )
dprintk(XENLOG_ERR VTDPREFIX,
"iommu_fault_status: Advanced Pending Fault\n");
INTEL_IOMMU_DEBUG("iommu_fault_status: Advanced Pending Fault\n");
if ( fault_status & DMA_FSTS_IQE )
dprintk(XENLOG_ERR VTDPREFIX,
"iommu_fault_status: Invalidation Queue Error\n");
INTEL_IOMMU_DEBUG("iommu_fault_status: Invalidation Queue Error\n");
if ( fault_status & DMA_FSTS_ICE )
dprintk(XENLOG_ERR VTDPREFIX,
"iommu_fault_status: Invalidation Completion Error\n");
INTEL_IOMMU_DEBUG("iommu_fault_status: Invalidation Completion Error\n");
if ( fault_status & DMA_FSTS_ITE )
dprintk(XENLOG_ERR VTDPREFIX,
"iommu_fault_status: Invalidation Time-out Error\n");
INTEL_IOMMU_DEBUG("iommu_fault_status: Invalidation Time-out Error\n");
}
#define PRIMARY_FAULT_REG_LEN (16)
......
......@@ -512,4 +512,11 @@ struct intel_iommu {
struct acpi_drhd_unit *drhd;
};
#define INTEL_IOMMU_DEBUG(fmt, args...) \
do \
{ \
if ( iommu_debug ) \
dprintk(XENLOG_WARNING VTDPREFIX, fmt, ## args); \
} while(0)
#endif
......@@ -35,7 +35,7 @@
#define AMD_IOMMU_DEBUG(fmt, args...) \
do \
{ \
if ( amd_iommu_debug ) \
if ( iommu_debug ) \
printk(XENLOG_INFO "AMD-Vi: " fmt, ## args); \
} while(0)
......
......@@ -31,7 +31,7 @@ extern bool_t force_iommu, iommu_verbose;
extern bool_t iommu_workaround_bios_bug, iommu_passthrough;
extern bool_t iommu_snoop, iommu_qinval, iommu_intremap;
extern bool_t iommu_hap_pt_share;
extern bool_t amd_iommu_debug;
extern bool_t iommu_debug;
extern bool_t amd_iommu_perdev_intremap;
extern struct rangeset *mmio_ro_ranges;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment