debuggers.hg

changeset 21085:95f5a4ce8f24

VT-d: reduce default verbosity

Introduce a new sub-option "verbose" to "iommu=", and hide most
(debugging) messages when that option is not specified. Particularly
messages printed after time management was initialized can, on
sufficiently large systems and with a graphical console, lead to
time management issues (therefore a call to process_pending_softirqs()
also gets added in case the new sub-option is being used).

While touching that code, also convert all improper uses of gdprintk()
to dprintk(), and convert all boolean iommu config variables to bool_t
residing in the .data.read_mostly section.

Signed-off-by: Jan Beulich <jbeulich@novell.com>
author Keir Fraser <keir.fraser@citrix.com>
date Wed Mar 17 08:35:13 2010 +0000 (2010-03-17)
parents 6384675aa29a
children b64a8d2a80ad
files xen/arch/x86/x86_64/mmconfig-shared.c xen/drivers/passthrough/amd/iommu_init.c xen/drivers/passthrough/io.c xen/drivers/passthrough/iommu.c xen/drivers/passthrough/vtd/dmar.c xen/drivers/passthrough/vtd/intremap.c xen/drivers/passthrough/vtd/iommu.c xen/include/xen/iommu.h
line diff
     1.1 --- a/xen/arch/x86/x86_64/mmconfig-shared.c	Wed Mar 17 08:34:16 2010 +0000
     1.2 +++ b/xen/arch/x86/x86_64/mmconfig-shared.c	Wed Mar 17 08:35:13 2010 +0000
     1.3 @@ -454,12 +454,7 @@ int pci_find_ext_capability(int seg, int
     1.4       * cap version and next pointer all being 0.
     1.5       */
     1.6      if ( (header == 0) || (header == -1) )
     1.7 -    {
     1.8 -        dprintk(XENLOG_INFO VTDPREFIX,
     1.9 -                "next cap:%x:%x.%x:  no extended config\n",
    1.10 -                bus, PCI_SLOT(devfn), PCI_FUNC(devfn));
    1.11          return 0;
    1.12 -    }
    1.13  
    1.14      while ( ttl-- > 0 ) {
    1.15          if ( PCI_EXT_CAP_ID(header) == cap )
     2.1 --- a/xen/drivers/passthrough/amd/iommu_init.c	Wed Mar 17 08:34:16 2010 +0000
     2.2 +++ b/xen/drivers/passthrough/amd/iommu_init.c	Wed Mar 17 08:35:13 2010 +0000
     2.3 @@ -355,7 +355,7 @@ static void iommu_msi_set_affinity(unsig
     2.4  
     2.5      dest = set_desc_affinity(desc, mask);
     2.6      if (dest == BAD_APICID){
     2.7 -        gdprintk(XENLOG_ERR, "Set iommu interrupt affinity error!\n");
     2.8 +        dprintk(XENLOG_ERR, "Set iommu interrupt affinity error!\n");
     2.9          return;
    2.10      }
    2.11  
    2.12 @@ -531,7 +531,7 @@ static int set_iommu_interrupt_handler(s
    2.13      irq = create_irq();
    2.14      if ( irq <= 0 )
    2.15      {
    2.16 -        gdprintk(XENLOG_ERR VTDPREFIX, "IOMMU: no irqs\n");
    2.17 +        dprintk(XENLOG_ERR, "IOMMU: no irqs\n");
    2.18          return 0;
    2.19      }
    2.20      
     3.1 --- a/xen/drivers/passthrough/io.c	Wed Mar 17 08:34:16 2010 +0000
     3.2 +++ b/xen/drivers/passthrough/io.c	Wed Mar 17 08:35:13 2010 +0000
     3.3 @@ -292,10 +292,12 @@ int pt_irq_create_bind_vtd(
     3.4              }
     3.5          }
     3.6  
     3.7 -        gdprintk(XENLOG_INFO VTDPREFIX,
     3.8 -                 "VT-d irq bind: m_irq = %x device = %x intx = %x\n",
     3.9 -                 machine_gsi, device, intx);
    3.10          spin_unlock(&d->event_lock);
    3.11 +
    3.12 +        if ( iommu_verbose )
    3.13 +            dprintk(VTDPREFIX,
    3.14 +                    "d%d: bind: m_gsi=%u g_gsi=%u device=%u intx=%u\n",
    3.15 +                    d->domain_id, machine_gsi, guest_gsi, device, intx);
    3.16      }
    3.17      return 0;
    3.18  }
    3.19 @@ -316,10 +318,11 @@ int pt_irq_destroy_bind_vtd(
    3.20      guest_gsi = hvm_pci_intx_gsi(device, intx);
    3.21      link = hvm_pci_intx_link(device, intx);
    3.22  
    3.23 -    gdprintk(XENLOG_INFO,
    3.24 -             "pt_irq_destroy_bind_vtd: machine_gsi=%d "
    3.25 -             "guest_gsi=%d, device=%d, intx=%d.\n",
    3.26 -             machine_gsi, guest_gsi, device, intx);
    3.27 +    if ( iommu_verbose )
    3.28 +        dprintk(VTDPREFIX,
    3.29 +                "d%d: unbind: m_gsi=%u g_gsi=%u device=%u intx=%u\n",
    3.30 +                d->domain_id, machine_gsi, guest_gsi, device, intx);
    3.31 +
    3.32      spin_lock(&d->event_lock);
    3.33  
    3.34      hvm_irq_dpci = domain_get_irq_dpci(d);
    3.35 @@ -372,9 +375,11 @@ int pt_irq_destroy_bind_vtd(
    3.36          }
    3.37      }
    3.38      spin_unlock(&d->event_lock);
    3.39 -    gdprintk(XENLOG_INFO,
    3.40 -             "XEN_DOMCTL_irq_unmapping: m_irq = 0x%x device = 0x%x intx = 0x%x\n",
    3.41 -             machine_gsi, device, intx);
    3.42 +
    3.43 +    if ( iommu_verbose )
    3.44 +        dprintk(VTDPREFIX,
    3.45 +                "d%d unmap: m_irq=%u device=%u intx=%u\n",
    3.46 +                d->domain_id, machine_gsi, device, intx);
    3.47  
    3.48      return 0;
    3.49  }
     4.1 --- a/xen/drivers/passthrough/iommu.c	Wed Mar 17 08:34:16 2010 +0000
     4.2 +++ b/xen/drivers/passthrough/iommu.c	Wed Mar 17 08:35:13 2010 +0000
     4.3 @@ -39,16 +39,17 @@ static int iommu_populate_page_table(str
     4.4   *   no-intremap                Disable VT-d Interrupt Remapping
     4.5   */
     4.6  custom_param("iommu", parse_iommu_param);
     4.7 -int iommu_enabled = 1;
     4.8 -int iommu_pv_enabled;
     4.9 -int force_iommu;
    4.10 -int iommu_workaround_bios_bug;
    4.11 -int iommu_passthrough;
    4.12 -int iommu_snoop = 1;
    4.13 -int iommu_qinval = 1;
    4.14 -int iommu_intremap = 1;
    4.15 -int amd_iommu_debug;
    4.16 -int amd_iommu_perdev_intremap;
    4.17 +bool_t __read_mostly iommu_enabled = 1;
    4.18 +bool_t __read_mostly iommu_pv_enabled;
    4.19 +bool_t __read_mostly force_iommu;
    4.20 +bool_t __read_mostly iommu_verbose;
    4.21 +bool_t __read_mostly iommu_workaround_bios_bug;
    4.22 +bool_t __read_mostly iommu_passthrough;
    4.23 +bool_t __read_mostly iommu_snoop = 1;
    4.24 +bool_t __read_mostly iommu_qinval = 1;
    4.25 +bool_t __read_mostly iommu_intremap = 1;
    4.26 +bool_t __read_mostly amd_iommu_debug;
    4.27 +bool_t __read_mostly amd_iommu_perdev_intremap;
    4.28  
    4.29  static void __init parse_iommu_param(char *s)
    4.30  {
    4.31 @@ -72,6 +73,8 @@ static void __init parse_iommu_param(cha
    4.32              iommu_workaround_bios_bug = 1;
    4.33          else if ( !strcmp(s, "passthrough") )
    4.34              iommu_passthrough = 1;
    4.35 +        else if ( !strcmp(s, "verbose") )
    4.36 +            iommu_verbose = 1;
    4.37          else if ( !strcmp(s, "no-snoop") )
    4.38              iommu_snoop = 0;
    4.39          else if ( !strcmp(s, "no-qinval") )
    4.40 @@ -251,17 +254,17 @@ int deassign_device(struct domain *d, u8
    4.41  
    4.42      if ( pdev->domain != d )
    4.43      {
    4.44 -        gdprintk(XENLOG_ERR VTDPREFIX,
    4.45 -                "IOMMU: deassign a device not owned\n");
    4.46 +        dprintk(XENLOG_ERR VTDPREFIX,
    4.47 +                "d%d: deassign a device not owned\n", d->domain_id);
    4.48          return -EINVAL;
    4.49      }
    4.50  
    4.51      ret = hd->platform_ops->reassign_device(d, dom0, bus, devfn);
    4.52      if ( ret )
    4.53      {
    4.54 -        gdprintk(XENLOG_ERR VTDPREFIX,
    4.55 -                 "Deassign device (%x:%x.%x) failed!\n",
    4.56 -                 bus, PCI_SLOT(devfn), PCI_FUNC(devfn));
    4.57 +        dprintk(XENLOG_ERR VTDPREFIX,
    4.58 +                "d%d: Deassign device (%x:%x.%x) failed!\n",
    4.59 +                d->domain_id, bus, PCI_SLOT(devfn), PCI_FUNC(devfn));
    4.60          return ret;
    4.61      }
    4.62  
     5.1 --- a/xen/drivers/passthrough/vtd/dmar.c	Wed Mar 17 08:34:16 2010 +0000
     5.2 +++ b/xen/drivers/passthrough/vtd/dmar.c	Wed Mar 17 08:35:13 2010 +0000
     5.3 @@ -313,27 +313,31 @@ static int __init acpi_parse_dev_scope(v
     5.4                  bus, path->dev, path->fn, PCI_SECONDARY_BUS);
     5.5              sub_bus = pci_conf_read8(
     5.6                  bus, path->dev, path->fn, PCI_SUBORDINATE_BUS);
     5.7 -            dprintk(XENLOG_INFO VTDPREFIX,
     5.8 -                    "  bridge: %x:%x.%x  start = %x sec = %x  sub = %x\n",
     5.9 -                    bus, path->dev, path->fn,
    5.10 -                    acpi_scope->start_bus, sec_bus, sub_bus);
    5.11 +            if ( iommu_verbose )
    5.12 +                dprintk(VTDPREFIX,
    5.13 +                        "  bridge: %x:%x.%x  start = %x sec = %x  sub = %x\n",
    5.14 +                        bus, path->dev, path->fn,
    5.15 +                        acpi_scope->start_bus, sec_bus, sub_bus);
    5.16  
    5.17              dmar_scope_add_buses(scope, sec_bus, sub_bus);
    5.18              break;
    5.19  
    5.20          case ACPI_DEV_MSI_HPET:
    5.21 -            dprintk(XENLOG_INFO VTDPREFIX, "  MSI HPET: %x:%x.%x\n",
    5.22 -                    bus, path->dev, path->fn);
    5.23 +            if ( iommu_verbose )
    5.24 +                dprintk(VTDPREFIX, "  MSI HPET: %x:%x.%x\n",
    5.25 +                        bus, path->dev, path->fn);
    5.26              break;
    5.27  
    5.28          case ACPI_DEV_ENDPOINT:
    5.29 -            dprintk(XENLOG_INFO VTDPREFIX, "  endpoint: %x:%x.%x\n",
    5.30 -                    bus, path->dev, path->fn);
    5.31 +            if ( iommu_verbose )
    5.32 +                dprintk(VTDPREFIX, "  endpoint: %x:%x.%x\n",
    5.33 +                        bus, path->dev, path->fn);
    5.34              break;
    5.35  
    5.36          case ACPI_DEV_IOAPIC:
    5.37 -            dprintk(XENLOG_INFO VTDPREFIX, "  IOAPIC: %x:%x.%x\n",
    5.38 -                    bus, path->dev, path->fn);
    5.39 +            if ( iommu_verbose )
    5.40 +                dprintk(VTDPREFIX, "  IOAPIC: %x:%x.%x\n",
    5.41 +                        bus, path->dev, path->fn);
    5.42  
    5.43              if ( type == DMAR_TYPE )
    5.44              {
    5.45 @@ -375,8 +379,9 @@ acpi_parse_one_drhd(struct acpi_dmar_ent
    5.46      dmaru->address = drhd->address;
    5.47      dmaru->include_all = drhd->flags & 1; /* BIT0: INCLUDE_ALL */
    5.48      INIT_LIST_HEAD(&dmaru->ioapic_list);
    5.49 -    dprintk(XENLOG_INFO VTDPREFIX, "  dmaru->address = %"PRIx64"\n",
    5.50 -            dmaru->address);
    5.51 +    if ( iommu_verbose )
    5.52 +        dprintk(VTDPREFIX, "  dmaru->address = %"PRIx64"\n",
    5.53 +                dmaru->address);
    5.54  
    5.55      addr = map_to_nocache_virt(0, drhd->address);
    5.56      dmaru->ecap = dmar_readq(addr, DMAR_ECAP_REG);
    5.57 @@ -388,7 +393,8 @@ acpi_parse_one_drhd(struct acpi_dmar_ent
    5.58  
    5.59      if ( dmaru->include_all )
    5.60      {
    5.61 -        dprintk(XENLOG_INFO VTDPREFIX, "  flags: INCLUDE_ALL\n");
    5.62 +        if ( iommu_verbose )
    5.63 +            dprintk(VTDPREFIX, "  flags: INCLUDE_ALL\n");
    5.64          /* Only allow one INCLUDE_ALL */
    5.65          if ( include_all )
    5.66          {
    5.67 @@ -541,9 +547,11 @@ acpi_parse_one_rmrr(struct acpi_dmar_ent
    5.68          }
    5.69          else
    5.70          {
    5.71 -            dprintk(XENLOG_INFO VTDPREFIX,
    5.72 -                "  RMRR region: base_addr %"PRIx64" end_address %"PRIx64"\n",
    5.73 -                rmrru->base_address, rmrru->end_address);
    5.74 +            if ( iommu_verbose )
    5.75 +                dprintk(VTDPREFIX,
    5.76 +                        "  RMRR region: base_addr %"PRIx64
    5.77 +                        " end_address %"PRIx64"\n",
    5.78 +                        rmrru->base_address, rmrru->end_address);
    5.79              acpi_register_rmrr_unit(rmrru);
    5.80          }
    5.81      }
    5.82 @@ -566,8 +574,9 @@ acpi_parse_one_atsr(struct acpi_dmar_ent
    5.83      memset(atsru, 0, sizeof(struct acpi_atsr_unit));
    5.84  
    5.85      atsru->all_ports = atsr->flags & 1; /* BIT0: ALL_PORTS */
    5.86 -    dprintk(XENLOG_INFO VTDPREFIX,
    5.87 -            "  atsru->all_ports: %x\n", atsru->all_ports);
    5.88 +    if ( iommu_verbose )
    5.89 +        dprintk(VTDPREFIX,
    5.90 +                "  atsru->all_ports: %x\n", atsru->all_ports);
    5.91      if ( !atsru->all_ports )
    5.92      {
    5.93          dev_scope_start = (void *)(atsr + 1);
    5.94 @@ -577,7 +586,8 @@ acpi_parse_one_atsr(struct acpi_dmar_ent
    5.95      }
    5.96      else
    5.97      {
    5.98 -        dprintk(XENLOG_INFO VTDPREFIX, "  flags: ALL_PORTS\n");
    5.99 +        if ( iommu_verbose )
   5.100 +            dprintk(VTDPREFIX, "  flags: ALL_PORTS\n");
   5.101          /* Only allow one ALL_PORTS */
   5.102          if ( all_ports )
   5.103          {
   5.104 @@ -610,9 +620,11 @@ acpi_parse_one_rhsa(struct acpi_dmar_ent
   5.105      rhsau->address = rhsa->address;
   5.106      rhsau->proximity_domain = rhsa->proximity_domain;
   5.107      list_add_tail(&rhsau->list, &acpi_rhsa_units);
   5.108 -    dprintk(XENLOG_INFO VTDPREFIX,
   5.109 -            "  rhsau->address: %"PRIx64" rhsau->proximity_domain: %"PRIx32"\n",
   5.110 -            rhsau->address, rhsau->proximity_domain);
   5.111 +    if ( iommu_verbose )
   5.112 +        dprintk(VTDPREFIX,
   5.113 +                "  rhsau->address: %"PRIx64
   5.114 +                " rhsau->proximity_domain: %"PRIx32"\n",
   5.115 +                rhsau->address, rhsau->proximity_domain);
   5.116  
   5.117      return ret;
   5.118  }
   5.119 @@ -639,8 +651,9 @@ static int __init acpi_parse_dmar(struct
   5.120      }
   5.121  
   5.122      dmar_host_address_width = dmar->width + 1;
   5.123 -    dprintk(XENLOG_INFO VTDPREFIX, "Host address width %d\n",
   5.124 -            dmar_host_address_width);
   5.125 +    if ( iommu_verbose )
   5.126 +        dprintk(VTDPREFIX, "Host address width %d\n",
   5.127 +                dmar_host_address_width);
   5.128  
   5.129      entry_header = (struct acpi_dmar_entry_header *)(dmar + 1);
   5.130      while ( ((unsigned long)entry_header) <
   5.131 @@ -649,23 +662,29 @@ static int __init acpi_parse_dmar(struct
   5.132          switch ( entry_header->type )
   5.133          {
   5.134          case ACPI_DMAR_DRHD:
   5.135 -            dprintk(XENLOG_INFO VTDPREFIX, "found ACPI_DMAR_DRHD:\n");
   5.136 +            if ( iommu_verbose )
   5.137 +                dprintk(VTDPREFIX, "found ACPI_DMAR_DRHD:\n");
   5.138              ret = acpi_parse_one_drhd(entry_header);
   5.139              break;
   5.140          case ACPI_DMAR_RMRR:
   5.141 -            dprintk(XENLOG_INFO VTDPREFIX, "found ACPI_DMAR_RMRR:\n");
   5.142 +            if ( iommu_verbose )
   5.143 +                dprintk(VTDPREFIX, "found ACPI_DMAR_RMRR:\n");
   5.144              ret = acpi_parse_one_rmrr(entry_header);
   5.145              break;
   5.146          case ACPI_DMAR_ATSR:
   5.147 -            dprintk(XENLOG_INFO VTDPREFIX, "found ACPI_DMAR_ATSR:\n");
   5.148 +            if ( iommu_verbose )
   5.149 +                dprintk(VTDPREFIX, "found ACPI_DMAR_ATSR:\n");
   5.150              ret = acpi_parse_one_atsr(entry_header);
   5.151              break;
   5.152          case ACPI_DMAR_RHSA:
   5.153 -            dprintk(XENLOG_INFO VTDPREFIX, "found ACPI_DMAR_RHSA:\n");
   5.154 +            if ( iommu_verbose )
   5.155 +                dprintk(VTDPREFIX, "found ACPI_DMAR_RHSA:\n");
   5.156              ret = acpi_parse_one_rhsa(entry_header);
   5.157              break;
   5.158          default:
   5.159 -            dprintk(XENLOG_WARNING VTDPREFIX, "Unknown DMAR structure type\n");
   5.160 +            dprintk(XENLOG_WARNING VTDPREFIX,
   5.161 +                    "Unknown DMAR structure type %x\n",
   5.162 +                    entry_header->type);
   5.163              ret = -EINVAL;
   5.164              break;
   5.165          }
     6.1 --- a/xen/drivers/passthrough/vtd/intremap.c	Wed Mar 17 08:34:16 2010 +0000
     6.2 +++ b/xen/drivers/passthrough/vtd/intremap.c	Wed Mar 17 08:35:13 2010 +0000
     6.3 @@ -484,9 +484,9 @@ static void set_msi_source_id(struct pci
     6.4          break;
     6.5  
     6.6      default:
     6.7 -        gdprintk(XENLOG_WARNING VTDPREFIX,
     6.8 -                 "set_msi_source_id: unknown type : bdf = %x:%x.%x\n",
     6.9 -                 bus, PCI_SLOT(devfn), PCI_FUNC(devfn));
    6.10 +        dprintk(XENLOG_WARNING VTDPREFIX, "d%d: unknown(%u): bdf = %x:%x.%x\n",
    6.11 +                pdev->domain->domain_id, type,
    6.12 +                bus, PCI_SLOT(devfn), PCI_FUNC(devfn));
    6.13          break;
    6.14     }
    6.15  }
     7.1 --- a/xen/drivers/passthrough/vtd/iommu.c	Wed Mar 17 08:34:16 2010 +0000
     7.2 +++ b/xen/drivers/passthrough/vtd/iommu.c	Wed Mar 17 08:35:13 2010 +0000
     7.3 @@ -63,9 +63,9 @@ static int domain_iommu_domid(struct dom
     7.4          i = find_next_bit(iommu->domid_bitmap, nr_dom, i+1);
     7.5      }
     7.6  
     7.7 -    gdprintk(XENLOG_ERR VTDPREFIX,
     7.8 -             "Cannot get valid iommu domid: domid=%d iommu->index=%d\n",
     7.9 -             d->domain_id, iommu->index);
    7.10 +    dprintk(XENLOG_ERR VTDPREFIX,
    7.11 +            "Cannot get valid iommu domid: domid=%d iommu->index=%d\n",
    7.12 +            d->domain_id, iommu->index);
    7.13      return -1;
    7.14  }
    7.15  
    7.16 @@ -97,7 +97,7 @@ static int context_set_domain_id(struct 
    7.17          i = find_first_zero_bit(iommu->domid_bitmap, nr_dom);
    7.18          if ( i >= nr_dom )
    7.19          {
    7.20 -            gdprintk(XENLOG_ERR VTDPREFIX, "IOMMU: no free domain ids\n");
    7.21 +            dprintk(XENLOG_ERR VTDPREFIX, "IOMMU: no free domain ids\n");
    7.22              return -EFAULT;
    7.23          }
    7.24          iommu->domid_map[i] = d->domain_id;
    7.25 @@ -690,8 +690,9 @@ static void iommu_enable_translation(str
    7.26      u32 sts;
    7.27      unsigned long flags;
    7.28  
    7.29 -    dprintk(XENLOG_INFO VTDPREFIX,
    7.30 -            "iommu_enable_translation: iommu->reg = %p\n", iommu->reg);
    7.31 +    if ( iommu_verbose )
    7.32 +        dprintk(VTDPREFIX,
    7.33 +                "iommu_enable_translation: iommu->reg = %p\n", iommu->reg);
    7.34      spin_lock_irqsave(&iommu->register_lock, flags);
    7.35      sts = dmar_readl(iommu->reg, DMAR_GSTS_REG);
    7.36      dmar_writel(iommu->reg, DMAR_GCMD_REG, sts | DMA_GCMD_TE);
    7.37 @@ -1070,11 +1071,14 @@ static int iommu_alloc(struct acpi_drhd_
    7.38  
    7.39      drhd->iommu = iommu;
    7.40  
    7.41 -    dprintk(XENLOG_DEBUG VTDPREFIX,
    7.42 -            "drhd->address = %"PRIx64" iommu->reg = %p\n",
    7.43 -            drhd->address, iommu->reg);
    7.44 -    dprintk(XENLOG_DEBUG VTDPREFIX,
    7.45 -            "cap = %"PRIx64" ecap = %"PRIx64"\n", iommu->cap, iommu->ecap);
    7.46 +    if ( iommu_verbose )
    7.47 +    {
    7.48 +        dprintk(VTDPREFIX,
    7.49 +                "drhd->address = %"PRIx64" iommu->reg = %p\n",
    7.50 +                drhd->address, iommu->reg);
    7.51 +        dprintk(VTDPREFIX,
    7.52 +                "cap = %"PRIx64" ecap = %"PRIx64"\n", iommu->cap, iommu->ecap);
    7.53 +    }
    7.54      if ( cap_fault_reg_offset(iommu->cap) +
    7.55           cap_num_fault_regs(iommu->cap) * PRIMARY_FAULT_REG_LEN >= PAGE_SIZE ||
    7.56           ecap_iotlb_offset(iommu->ecap) >= PAGE_SIZE )
    7.57 @@ -1316,16 +1320,16 @@ static int domain_context_mapping(struct
    7.58          break;
    7.59  
    7.60      case DEV_TYPE_PCIe_ENDPOINT:
    7.61 -        gdprintk(XENLOG_INFO VTDPREFIX,
    7.62 -                 "domain_context_mapping:PCIe: bdf = %x:%x.%x\n",
    7.63 -                 bus, PCI_SLOT(devfn), PCI_FUNC(devfn));
    7.64 +        if ( iommu_verbose )
    7.65 +            dprintk(VTDPREFIX, "d%d:PCIe: map bdf = %x:%x.%x\n",
    7.66 +                    domain->domain_id, bus, PCI_SLOT(devfn), PCI_FUNC(devfn));
    7.67          ret = domain_context_mapping_one(domain, drhd->iommu, bus, devfn);
    7.68          break;
    7.69  
    7.70      case DEV_TYPE_PCI:
    7.71 -        gdprintk(XENLOG_INFO VTDPREFIX,
    7.72 -                 "domain_context_mapping:PCI: bdf = %x:%x.%x\n",
    7.73 -                 bus, PCI_SLOT(devfn), PCI_FUNC(devfn));
    7.74 +        if ( iommu_verbose )
    7.75 +            dprintk(VTDPREFIX, "d%d:PCI: map bdf = %x:%x.%x\n",
    7.76 +                    domain->domain_id, bus, PCI_SLOT(devfn), PCI_FUNC(devfn));
    7.77  
    7.78          ret = domain_context_mapping_one(domain, drhd->iommu, bus, devfn);
    7.79          if ( ret )
    7.80 @@ -1355,13 +1359,16 @@ static int domain_context_mapping(struct
    7.81          break;
    7.82  
    7.83      default:
    7.84 -        gdprintk(XENLOG_ERR VTDPREFIX,
    7.85 -                 "domain_context_mapping:unknown type : bdf = %x:%x.%x\n",
    7.86 -                 bus, PCI_SLOT(devfn), PCI_FUNC(devfn));
    7.87 +        dprintk(XENLOG_ERR VTDPREFIX, "d%d:unknown(%u): bdf = %x:%x.%x\n",
    7.88 +                domain->domain_id, type,
    7.89 +                bus, PCI_SLOT(devfn), PCI_FUNC(devfn));
    7.90          ret = -EINVAL;
    7.91          break;
    7.92      }
    7.93  
    7.94 +    if ( iommu_verbose )
    7.95 +        process_pending_softirqs();
    7.96 +
    7.97      return ret;
    7.98  }
    7.99  
   7.100 @@ -1442,16 +1449,16 @@ static int domain_context_unmap(struct d
   7.101          goto out;
   7.102  
   7.103      case DEV_TYPE_PCIe_ENDPOINT:
   7.104 -        gdprintk(XENLOG_INFO VTDPREFIX,
   7.105 -                 "domain_context_unmap:PCIe: bdf = %x:%x.%x\n",
   7.106 -                 bus, PCI_SLOT(devfn), PCI_FUNC(devfn));
   7.107 +        if ( iommu_verbose )
   7.108 +            dprintk(VTDPREFIX, "d%d:PCIe: unmap bdf = %x:%x.%x\n",
   7.109 +                    domain->domain_id, bus, PCI_SLOT(devfn), PCI_FUNC(devfn));
   7.110          ret = domain_context_unmap_one(domain, iommu, bus, devfn);
   7.111          break;
   7.112  
   7.113      case DEV_TYPE_PCI:
   7.114 -        gdprintk(XENLOG_INFO VTDPREFIX,
   7.115 -                 "domain_context_unmap:PCI: bdf = %x:%x.%x\n",
   7.116 -                 bus, PCI_SLOT(devfn), PCI_FUNC(devfn));
   7.117 +        if ( iommu_verbose )
   7.118 +            dprintk(VTDPREFIX, "d%d:PCI: unmap bdf = %x:%x.%x\n",
   7.119 +                    domain->domain_id, bus, PCI_SLOT(devfn), PCI_FUNC(devfn));
   7.120          ret = domain_context_unmap_one(domain, iommu, bus, devfn);
   7.121          if ( ret )
   7.122              break;
   7.123 @@ -1476,9 +1483,9 @@ static int domain_context_unmap(struct d
   7.124          break;
   7.125  
   7.126      default:
   7.127 -        gdprintk(XENLOG_ERR VTDPREFIX,
   7.128 -                 "domain_context_unmap:unknown type: bdf = %x:%x.%x\n",
   7.129 -                 bus, PCI_SLOT(devfn), PCI_FUNC(devfn));
   7.130 +        dprintk(XENLOG_ERR VTDPREFIX, "d%d:unknown(%u): bdf = %x:%x.%x\n",
   7.131 +                domain->domain_id, type,
   7.132 +                bus, PCI_SLOT(devfn), PCI_FUNC(devfn));
   7.133          ret = -EINVAL;
   7.134          goto out;
   7.135      }
   7.136 @@ -1702,8 +1709,8 @@ static int intel_iommu_add_device(struct
   7.137      ret = domain_context_mapping(pdev->domain, pdev->bus, pdev->devfn);
   7.138      if ( ret )
   7.139      {
   7.140 -        gdprintk(XENLOG_ERR VTDPREFIX,
   7.141 -                 "intel_iommu_add_device: context mapping failed\n");
   7.142 +        dprintk(XENLOG_ERR VTDPREFIX, "d%d: context mapping failed\n",
   7.143 +                pdev->domain->domain_id);
   7.144          return ret;
   7.145      }
   7.146  
   7.147 @@ -1713,8 +1720,8 @@ static int intel_iommu_add_device(struct
   7.148          {
   7.149              ret = rmrr_identity_mapping(pdev->domain, rmrr);
   7.150              if ( ret )
   7.151 -                gdprintk(XENLOG_ERR VTDPREFIX,
   7.152 -                         "intel_iommu_add_device: RMRR mapping failed\n");
   7.153 +                dprintk(XENLOG_ERR VTDPREFIX, "d%d: RMRR mapping failed\n",
   7.154 +                        pdev->domain->domain_id);
   7.155          }
   7.156      }
   7.157  
   7.158 @@ -2031,7 +2038,7 @@ static int intel_iommu_assign_device(str
   7.159  
   7.160      if (pdev->domain != dom0)
   7.161      {
   7.162 -        gdprintk(XENLOG_ERR VTDPREFIX,
   7.163 +        dprintk(XENLOG_ERR VTDPREFIX,
   7.164                  "IOMMU: assign a assigned device\n");
   7.165         return -EBUSY;
   7.166      }
   7.167 @@ -2057,8 +2064,8 @@ static int intel_iommu_assign_device(str
   7.168              ret = rmrr_identity_mapping(d, rmrr);
   7.169              if ( ret )
   7.170              {
   7.171 -                gdprintk(XENLOG_ERR VTDPREFIX,
   7.172 -                         "IOMMU: mapping reserved region failed\n");
   7.173 +                dprintk(XENLOG_ERR VTDPREFIX,
   7.174 +                        "IOMMU: mapping reserved region failed\n");
   7.175                  goto done;
   7.176              }
   7.177          }
     8.1 --- a/xen/include/xen/iommu.h	Wed Mar 17 08:34:16 2010 +0000
     8.2 +++ b/xen/include/xen/iommu.h	Wed Mar 17 08:35:13 2010 +0000
     8.3 @@ -26,14 +26,10 @@
     8.4  #include <public/hvm/ioreq.h>
     8.5  #include <public/domctl.h>
     8.6  
     8.7 -extern int iommu_enabled;
     8.8 -extern int iommu_pv_enabled;
     8.9 -extern int force_iommu;
    8.10 -extern int iommu_workaround_bios_bug;
    8.11 -extern int iommu_passthrough;
    8.12 -extern int iommu_snoop;
    8.13 -extern int iommu_qinval;
    8.14 -extern int iommu_intremap;
    8.15 +extern bool_t iommu_enabled, iommu_pv_enabled;
    8.16 +extern bool_t force_iommu, iommu_verbose;
    8.17 +extern bool_t iommu_workaround_bios_bug, iommu_passthrough;
    8.18 +extern bool_t iommu_snoop, iommu_qinval, iommu_intremap;
    8.19  
    8.20  #define domain_hvm_iommu(d)     (&d->arch.hvm_domain.hvm_iommu)
    8.21