ia64/xen-unstable

changeset 18186:507045f254e9

vtd: Fix some dmar bugs

In acpi_parse_one_drhd(), remove return directly when only one
INCLUDE_ALL check fails, so that avoid memory leak. In addition,
remove "dmaru->scope.devices_cnt == 0 && !dmaru->include_all" check,
due to PCI-PCI bridges are not counted.

This patch fixes bug #1307.

Signed-off-by: Weidong Han <weidong.han@intel.com>
author Keir Fraser <keir.fraser@citrix.com>
date Tue Jul 29 10:41:41 2008 +0100 (2008-07-29)
parents 7f65527eacd6
children 9454fae58cb8
files xen/drivers/passthrough/vtd/dmar.c
line diff
     1.1 --- a/xen/drivers/passthrough/vtd/dmar.c	Tue Jul 29 10:05:32 2008 +0100
     1.2 +++ b/xen/drivers/passthrough/vtd/dmar.c	Tue Jul 29 10:41:41 2008 +0100
     1.3 @@ -238,15 +238,15 @@ static int __init acpi_parse_dev_scope(v
     1.4              bus = pci_conf_read8(bus, path->dev, path->fn, PCI_SECONDARY_BUS);
     1.5              path++;
     1.6          }
     1.7 -        
     1.8 +
     1.9          switch ( acpi_scope->dev_type )
    1.10          {
    1.11          case ACPI_DEV_P2PBRIDGE:
    1.12          {
    1.13              sec_bus = pci_conf_read8(
    1.14 -		bus, path->dev, path->fn, PCI_SECONDARY_BUS);
    1.15 +                bus, path->dev, path->fn, PCI_SECONDARY_BUS);
    1.16              sub_bus = pci_conf_read8(
    1.17 -		bus, path->dev, path->fn, PCI_SUBORDINATE_BUS);
    1.18 +                bus, path->dev, path->fn, PCI_SUBORDINATE_BUS);
    1.19              dprintk(XENLOG_INFO VTDPREFIX,
    1.20                      "found bridge: bdf = %x:%x.%x  sec = %x  sub = %x\n",
    1.21                      bus, path->dev, path->fn, sec_bus, sub_bus);
    1.22 @@ -328,13 +328,13 @@ acpi_parse_one_drhd(struct acpi_dmar_ent
    1.23          if ( include_all )
    1.24          {
    1.25              dprintk(XENLOG_WARNING VTDPREFIX,
    1.26 -                    "Onlyu onw INCLUDE_ALL device scope is allowed\n");
    1.27 -            return -EINVAL;
    1.28 +                    "Only one INCLUDE_ALL device scope is allowed\n");
    1.29 +            ret = -EINVAL;
    1.30          }
    1.31          include_all = 1;
    1.32      }
    1.33  
    1.34 -    if ( ret || (dmaru->scope.devices_cnt == 0 && !dmaru->include_all) )
    1.35 +    if ( ret )
    1.36          xfree(dmaru);
    1.37      else
    1.38          acpi_register_drhd_unit(dmaru);
    1.39 @@ -396,7 +396,8 @@ acpi_parse_one_atsr(struct acpi_dmar_ent
    1.40          ret = acpi_parse_dev_scope(dev_scope_start, dev_scope_end,
    1.41                                     atsru, ATSR_TYPE);
    1.42      }
    1.43 -    else {
    1.44 +    else
    1.45 +    {
    1.46          dprintk(XENLOG_INFO VTDPREFIX, "found ALL_PORTS\n");
    1.47          /* Only allow one ALL_PORTS */
    1.48          if ( all_ports )