143 lines
5.4 KiB
Diff
143 lines
5.4 KiB
Diff
|
# HG changeset patch
|
||
|
# User Allen Kay <allen.m.kay@intel.com>
|
||
|
# Date 1308823884 -3600
|
||
|
# Node ID d3ac71f22e8621d9a7604f82f3976337e6c97a9a
|
||
|
# Parent 065ca14be963fe4da55d629ed0b3692a14253a86
|
||
|
[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: Allen Kay <allen.m.kay@intel.com>
|
||
|
|
||
|
--- a/xen/drivers/passthrough/amd/iommu_acpi.c
|
||
|
+++ b/xen/drivers/passthrough/amd/iommu_acpi.c
|
||
|
@@ -822,7 +822,7 @@ static int __init parse_ivrs_table(struc
|
||
|
|
||
|
BUG_ON(!table);
|
||
|
|
||
|
- if ( amd_iommu_debug )
|
||
|
+ if ( iommu_debug )
|
||
|
dump_acpi_table_header(table);
|
||
|
|
||
|
/* parse IVRS blocks */
|
||
|
--- a/xen/drivers/passthrough/iommu.c
|
||
|
+++ b/xen/drivers/passthrough/iommu.c
|
||
|
@@ -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(cha
|
||
|
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") )
|
||
|
--- a/xen/drivers/passthrough/vtd/iommu.c
|
||
|
+++ b/xen/drivers/passthrough/vtd/iommu.c
|
||
|
@@ -821,7 +821,7 @@ static int iommu_page_fault_do_one(struc
|
||
|
|
||
|
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",
|
||
|
@@ -830,12 +830,13 @@ static int iommu_page_fault_do_one(struc
|
||
|
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",
|
||
|
@@ -849,26 +850,19 @@ static int iommu_page_fault_do_one(struc
|
||
|
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)
|
||
|
--- a/xen/drivers/passthrough/vtd/iommu.h
|
||
|
+++ b/xen/drivers/passthrough/vtd/iommu.h
|
||
|
@@ -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
|
||
|
--- a/xen/include/asm-x86/hvm/svm/amd-iommu-proto.h
|
||
|
+++ b/xen/include/asm-x86/hvm/svm/amd-iommu-proto.h
|
||
|
@@ -34,7 +34,7 @@
|
||
|
#define AMD_IOMMU_DEBUG(fmt, args...) \
|
||
|
do \
|
||
|
{ \
|
||
|
- if ( amd_iommu_debug ) \
|
||
|
+ if ( iommu_debug ) \
|
||
|
printk(XENLOG_INFO "AMD-Vi: " fmt, ## args); \
|
||
|
} while(0)
|
||
|
|
||
|
--- a/xen/include/xen/iommu.h
|
||
|
+++ b/xen/include/xen/iommu.h
|
||
|
@@ -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;
|