ia64/xen-unstable

changeset 17512:ee8fe9aa9c55

vt-d: Reduce printk() output to a more sensible level.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
author Keir Fraser <keir.fraser@citrix.com>
date Wed Apr 23 13:51:55 2008 +0100 (2008-04-23)
parents 86b8417db325
children a7ddd6bcd564
files xen/drivers/passthrough/vtd/dmar.c xen/drivers/passthrough/vtd/iommu.c xen/drivers/passthrough/vtd/x86/vtd.c
line diff
     1.1 --- a/xen/drivers/passthrough/vtd/dmar.c	Wed Apr 23 13:29:09 2008 +0100
     1.2 +++ b/xen/drivers/passthrough/vtd/dmar.c	Wed Apr 23 13:51:55 2008 +0100
     1.3 @@ -78,14 +78,9 @@ static int acpi_ioapic_device_match(
     1.4  struct acpi_drhd_unit * ioapic_to_drhd(unsigned int apic_id)
     1.5  {
     1.6      struct acpi_drhd_unit *drhd;
     1.7 -    list_for_each_entry( drhd, &acpi_drhd_units, list ) {
     1.8 -        if ( acpi_ioapic_device_match(&drhd->ioapic_list, apic_id) ) {
     1.9 -            dprintk(XENLOG_INFO VTDPREFIX,
    1.10 -                    "ioapic_to_drhd: drhd->address = %lx\n",
    1.11 -                    drhd->address);
    1.12 +    list_for_each_entry( drhd, &acpi_drhd_units, list )
    1.13 +        if ( acpi_ioapic_device_match(&drhd->ioapic_list, apic_id) )
    1.14              return drhd;
    1.15 -        }
    1.16 -    }
    1.17      return NULL;
    1.18  }
    1.19  
    1.20 @@ -93,15 +88,9 @@ struct iommu * ioapic_to_iommu(unsigned 
    1.21  {
    1.22      struct acpi_drhd_unit *drhd;
    1.23  
    1.24 -    list_for_each_entry( drhd, &acpi_drhd_units, list ) {
    1.25 -        if ( acpi_ioapic_device_match(&drhd->ioapic_list, apic_id) ) {
    1.26 -            dprintk(XENLOG_INFO VTDPREFIX,
    1.27 -                    "ioapic_to_iommu: drhd->address = %lx\n",
    1.28 -                    drhd->address);
    1.29 +    list_for_each_entry( drhd, &acpi_drhd_units, list )
    1.30 +        if ( acpi_ioapic_device_match(&drhd->ioapic_list, apic_id) )
    1.31              return drhd->iommu;
    1.32 -        }
    1.33 -    }
    1.34 -    dprintk(XENLOG_INFO VTDPREFIX, "returning NULL\n");
    1.35      return NULL;
    1.36  }
    1.37  
    1.38 @@ -149,21 +138,11 @@ struct acpi_drhd_unit * acpi_find_matche
    1.39  
    1.40          if ( acpi_pci_device_match(drhd->devices,
    1.41                                     drhd->devices_cnt, dev) )
    1.42 -        {
    1.43 -            dprintk(XENLOG_INFO VTDPREFIX, 
    1.44 -                    "acpi_find_matched_drhd_unit: drhd->address = %lx\n",
    1.45 -                    drhd->address);
    1.46              return drhd;
    1.47 -        }
    1.48      }
    1.49  
    1.50      if ( include_all_drhd )
    1.51 -    {
    1.52 -        dprintk(XENLOG_INFO VTDPREFIX, 
    1.53 -                "acpi_find_matched_drhd_unit:include_all_drhd->addr = %lx\n",
    1.54 -                include_all_drhd->address);
    1.55          return include_all_drhd;
    1.56 -    }
    1.57  
    1.58      return NULL;
    1.59  }
    1.60 @@ -173,11 +152,9 @@ struct acpi_rmrr_unit * acpi_find_matche
    1.61      struct acpi_rmrr_unit *rmrr;
    1.62  
    1.63      list_for_each_entry ( rmrr, &acpi_rmrr_units, list )
    1.64 -    {
    1.65          if ( acpi_pci_device_match(rmrr->devices,
    1.66                                     rmrr->devices_cnt, dev) )
    1.67              return rmrr;
    1.68 -    }
    1.69  
    1.70      return NULL;
    1.71  }
    1.72 @@ -198,11 +175,7 @@ struct acpi_atsr_unit * acpi_find_matche
    1.73      }
    1.74  
    1.75      if ( all_ports_atsru )
    1.76 -    {
    1.77 -        dprintk(XENLOG_INFO VTDPREFIX,
    1.78 -                "acpi_find_matched_atsr_unit: all_ports_atsru\n");
    1.79          return all_ports_atsru;;
    1.80 -    }
    1.81  
    1.82      return NULL;
    1.83  }
     2.1 --- a/xen/drivers/passthrough/vtd/iommu.c	Wed Apr 23 13:29:09 2008 +0100
     2.2 +++ b/xen/drivers/passthrough/vtd/iommu.c	Wed Apr 23 13:51:55 2008 +0100
     2.3 @@ -82,11 +82,7 @@ static struct intel_iommu *alloc_intel_i
     2.4  
     2.5      intel = xmalloc(struct intel_iommu);
     2.6      if ( intel == NULL )
     2.7 -    {
     2.8 -        gdprintk(XENLOG_ERR VTDPREFIX,
     2.9 -                 "Allocate intel_iommu failed.\n");
    2.10          return NULL;
    2.11 -    }
    2.12      memset(intel, 0, sizeof(struct intel_iommu));
    2.13  
    2.14      spin_lock_init(&intel->qi_ctrl.qinval_lock);
    2.15 @@ -682,20 +678,12 @@ void dma_pte_free_pagetable(struct domai
    2.16      }
    2.17  }
    2.18  
    2.19 -/* iommu handling */
    2.20  static int iommu_set_root_entry(struct iommu *iommu)
    2.21  {
    2.22      u32 cmd, sts;
    2.23      unsigned long flags;
    2.24      s_time_t start_time;
    2.25  
    2.26 -    if ( iommu == NULL )
    2.27 -    {
    2.28 -        gdprintk(XENLOG_ERR VTDPREFIX,
    2.29 -                 "iommu_set_root_entry: iommu == NULL\n");
    2.30 -        return -EINVAL;
    2.31 -    }
    2.32 -
    2.33      if ( iommu->root_maddr != 0 )
    2.34      {
    2.35          free_pgtable_maddr(iommu->root_maddr);
    2.36 @@ -1131,28 +1119,15 @@ static int domain_context_mapping_one(
    2.37      struct hvm_iommu *hd = domain_hvm_iommu(domain);
    2.38      struct context_entry *context, *context_entries;
    2.39      unsigned long flags;
    2.40 -    int ret = 0;
    2.41      u64 maddr;
    2.42  
    2.43      maddr = bus_to_context_maddr(iommu, bus);
    2.44      context_entries = (struct context_entry *)map_vtd_domain_page(maddr);
    2.45      context = &context_entries[devfn];
    2.46 -    if ( !context )
    2.47 -    {
    2.48 -        unmap_vtd_domain_page(context_entries);
    2.49 -        gdprintk(XENLOG_ERR VTDPREFIX,
    2.50 -                 "domain_context_mapping_one:context == NULL:"
    2.51 -                 "bdf = %x:%x:%x\n",
    2.52 -                 bus, PCI_SLOT(devfn), PCI_FUNC(devfn));
    2.53 -        return -ENOMEM;
    2.54 -    }
    2.55  
    2.56      if ( context_present(*context) )
    2.57      {
    2.58          unmap_vtd_domain_page(context_entries);
    2.59 -        gdprintk(XENLOG_WARNING VTDPREFIX,
    2.60 -                 "domain_context_mapping_one:context present:bdf=%x:%x:%x\n",
    2.61 -                 bus, PCI_SLOT(devfn), PCI_FUNC(devfn));
    2.62          return 0;
    2.63      }
    2.64  
    2.65 @@ -1181,12 +1156,6 @@ static int domain_context_mapping_one(
    2.66      context_set_present(*context);
    2.67      iommu_flush_cache_entry(iommu, context);
    2.68  
    2.69 -    gdprintk(XENLOG_INFO VTDPREFIX,
    2.70 -             "domain_context_mapping_one-%x:%x:%x-*context=%"PRIx64":%"PRIx64
    2.71 -             " hd->pgd_maddr=%"PRIx64"\n",
    2.72 -             bus, PCI_SLOT(devfn), PCI_FUNC(devfn),
    2.73 -             context->hi, context->lo, hd->pgd_maddr);
    2.74 -
    2.75      unmap_vtd_domain_page(context_entries);
    2.76  
    2.77      if ( iommu_flush_context_device(iommu, domain_iommu_domid(domain),
    2.78 @@ -1196,7 +1165,8 @@ static int domain_context_mapping_one(
    2.79      else
    2.80          iommu_flush_iotlb_dsi(iommu, domain_iommu_domid(domain), 0);
    2.81      spin_unlock_irqrestore(&iommu->lock, flags);
    2.82 -    return ret;
    2.83 +
    2.84 +    return 0;
    2.85  }
    2.86  
    2.87  static int __pci_find_next_cap(u8 bus, unsigned int devfn, u8 pos, int cap)
    2.88 @@ -1355,29 +1325,13 @@ static int domain_context_unmap_one(
    2.89      maddr = bus_to_context_maddr(iommu, bus);
    2.90      context_entries = (struct context_entry *)map_vtd_domain_page(maddr);
    2.91      context = &context_entries[devfn];
    2.92 -    if ( !context )
    2.93 -    {
    2.94 -        unmap_vtd_domain_page(context_entries);
    2.95 -        gdprintk(XENLOG_ERR VTDPREFIX,
    2.96 -                 "domain_context_unmap_one-%x:%x:%x- context == NULL:return\n",
    2.97 -                 bus, PCI_SLOT(devfn), PCI_FUNC(devfn));
    2.98 -        return -ENOMEM;
    2.99 -    }
   2.100  
   2.101      if ( !context_present(*context) )
   2.102      {
   2.103          unmap_vtd_domain_page(context_entries);
   2.104 -        gdprintk(XENLOG_WARNING VTDPREFIX,
   2.105 -                 "domain_context_unmap_one-%x:%x:%x- "
   2.106 -                 "context NOT present:return\n",
   2.107 -                 bus, PCI_SLOT(devfn), PCI_FUNC(devfn));
   2.108          return 0;
   2.109      }
   2.110  
   2.111 -    gdprintk(XENLOG_INFO VTDPREFIX,
   2.112 -             "domain_context_unmap_one: bdf = %x:%x:%x\n",
   2.113 -             bus, PCI_SLOT(devfn), PCI_FUNC(devfn));
   2.114 -
   2.115      spin_lock_irqsave(&iommu->lock, flags);
   2.116      context_clear_present(*context);
   2.117      context_clear_entry(*context);
   2.118 @@ -1409,24 +1363,12 @@ static int domain_context_unmap(
   2.119          sub_bus = pci_conf_read8(
   2.120              pdev->bus, PCI_SLOT(pdev->devfn),
   2.121              PCI_FUNC(pdev->devfn), PCI_SUBORDINATE_BUS);
   2.122 -
   2.123 -        gdprintk(XENLOG_INFO VTDPREFIX,
   2.124 -                 "domain_context_unmap:BRIDGE:%x:%x:%x "
   2.125 -                 "sec_bus=%x sub_bus=%x\n",
   2.126 -                 pdev->bus, PCI_SLOT(pdev->devfn),
   2.127 -                 PCI_FUNC(pdev->devfn), sec_bus, sub_bus);
   2.128          break;
   2.129      case DEV_TYPE_PCIe_ENDPOINT:
   2.130 -        gdprintk(XENLOG_INFO VTDPREFIX,
   2.131 -                 "domain_context_unmap:PCIe : bdf = %x:%x:%x\n",
   2.132 -                 pdev->bus, PCI_SLOT(pdev->devfn), PCI_FUNC(pdev->devfn));
   2.133          ret = domain_context_unmap_one(domain, iommu,
   2.134                                         (u8)(pdev->bus), (u8)(pdev->devfn));
   2.135          break;
   2.136      case DEV_TYPE_PCI:
   2.137 -        gdprintk(XENLOG_INFO VTDPREFIX,
   2.138 -                 "domain_context_unmap:PCI: bdf = %x:%x:%x\n",
   2.139 -                 pdev->bus, PCI_SLOT(pdev->devfn), PCI_FUNC(pdev->devfn));
   2.140          if ( pdev->bus == 0 )
   2.141              ret = domain_context_unmap_one(
   2.142                  domain, iommu,
   2.143 @@ -1480,35 +1422,29 @@ void reassign_device_ownership(
   2.144      int status;
   2.145      unsigned long flags;
   2.146  
   2.147 -    gdprintk(XENLOG_INFO VTDPREFIX,
   2.148 -             "reassign_device-%x:%x:%x- source = %d target = %d\n",
   2.149 -             bus, PCI_SLOT(devfn), PCI_FUNC(devfn),
   2.150 -             source->domain_id, target->domain_id);
   2.151 -
   2.152      pdev_flr(bus, devfn);
   2.153  
   2.154      for_each_pdev( source, pdev )
   2.155 -    {
   2.156 -        if ( (pdev->bus != bus) || (pdev->devfn != devfn) )
   2.157 -            continue;
   2.158 +        if ( (pdev->bus == bus) && (pdev->devfn == devfn) )
   2.159 +            goto found;
   2.160 +
   2.161 +    return;
   2.162  
   2.163 -        drhd = acpi_find_matched_drhd_unit(pdev);
   2.164 -        iommu = drhd->iommu;
   2.165 -        domain_context_unmap(source, iommu, pdev);
   2.166 + found:
   2.167 +    drhd = acpi_find_matched_drhd_unit(pdev);
   2.168 +    iommu = drhd->iommu;
   2.169 +    domain_context_unmap(source, iommu, pdev);
   2.170  
   2.171 -        /* Move pci device from the source domain to target domain. */
   2.172 -        spin_lock_irqsave(&source_hd->iommu_list_lock, flags);
   2.173 -        spin_lock_irqsave(&target_hd->iommu_list_lock, flags);
   2.174 -        list_move(&pdev->list, &target_hd->pdev_list);
   2.175 -        spin_unlock_irqrestore(&target_hd->iommu_list_lock, flags);
   2.176 -        spin_unlock_irqrestore(&source_hd->iommu_list_lock, flags);
   2.177 +    /* Move pci device from the source domain to target domain. */
   2.178 +    spin_lock_irqsave(&source_hd->iommu_list_lock, flags);
   2.179 +    spin_lock_irqsave(&target_hd->iommu_list_lock, flags);
   2.180 +    list_move(&pdev->list, &target_hd->pdev_list);
   2.181 +    spin_unlock_irqrestore(&target_hd->iommu_list_lock, flags);
   2.182 +    spin_unlock_irqrestore(&source_hd->iommu_list_lock, flags);
   2.183  
   2.184 -        status = domain_context_mapping(target, iommu, pdev);
   2.185 -        if ( status != 0 )
   2.186 -            gdprintk(XENLOG_ERR VTDPREFIX, "domain_context_mapping failed\n");
   2.187 -
   2.188 -        break;
   2.189 -    }
   2.190 +    status = domain_context_mapping(target, iommu, pdev);
   2.191 +    if ( status != 0 )
   2.192 +        gdprintk(XENLOG_ERR VTDPREFIX, "domain_context_mapping failed\n");
   2.193  }
   2.194  
   2.195  void return_devices_to_dom0(struct domain *d)
   2.196 @@ -1519,9 +1455,6 @@ void return_devices_to_dom0(struct domai
   2.197      while ( !list_empty(&hd->pdev_list) )
   2.198      {
   2.199          pdev = list_entry(hd->pdev_list.next, typeof(*pdev), list);
   2.200 -        dprintk(XENLOG_INFO VTDPREFIX,
   2.201 -                "return_devices_to_dom0: bdf = %x:%x:%x\n",
   2.202 -                pdev->bus, PCI_SLOT(pdev->devfn), PCI_FUNC(pdev->devfn));
   2.203          reassign_device_ownership(d, dom0, pdev->bus, pdev->devfn);
   2.204      }
   2.205  
   2.206 @@ -1754,11 +1687,6 @@ static void setup_dom0_devices(struct do
   2.207              }
   2.208          }
   2.209      }
   2.210 -
   2.211 -    for_each_pdev ( d, pdev )
   2.212 -        dprintk(XENLOG_INFO VTDPREFIX,
   2.213 -                "setup_dom0_devices: bdf = %x:%x:%x\n",
   2.214 -                pdev->bus, PCI_SLOT(pdev->devfn), PCI_FUNC(pdev->devfn));
   2.215  }
   2.216  
   2.217  void clear_fault_bits(struct iommu *iommu)
   2.218 @@ -1902,10 +1830,6 @@ int intel_iommu_assign_device(struct dom
   2.219      if ( list_empty(&acpi_drhd_units) )
   2.220          return ret;
   2.221  
   2.222 -    gdprintk(XENLOG_INFO VTDPREFIX,
   2.223 -             "assign_device: bus = %x dev = %x func = %x\n",
   2.224 -             bus, PCI_SLOT(devfn), PCI_FUNC(devfn));
   2.225 -
   2.226      reassign_device_ownership(dom0, d, bus, devfn);
   2.227  
   2.228      /* Setup rmrr identify mapping */
     3.1 --- a/xen/drivers/passthrough/vtd/x86/vtd.c	Wed Apr 23 13:29:09 2008 +0100
     3.2 +++ b/xen/drivers/passthrough/vtd/x86/vtd.c	Wed Apr 23 13:51:55 2008 +0100
     3.3 @@ -114,8 +114,6 @@ void hvm_dpci_isairq_eoi(struct domain *
     3.4                  if ( --dpci->mirq[i].pending == 0 )
     3.5                  {
     3.6                      spin_unlock(&dpci->dirq_lock);
     3.7 -                    gdprintk(XENLOG_INFO VTDPREFIX,
     3.8 -                             "hvm_dpci_isairq_eoi:: mirq = %x\n", i);
     3.9                      stop_timer(&dpci->hvm_timer[irq_to_vector(i)]);
    3.10                      pirq_guest_eoi(d, i);
    3.11                  }